473,414 Members | 1,626 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

page reloads

I have the following code to populate a list box when my form opens. The
problem is that when I select something from the listbox the page reloads and
goes to the top of the page. I need it to not do that so that I can finish
filling out the form and then hit submit button.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
strconnectionstring = "Provider=sqloledb;data
source=ntserver3;initial catalog=Family_Consultation_test;user
id=sa;password=guru;"
objoledbconnection = New OleDb.OleDbConnection(strconnectionstring)
objoledbcommand = New OleDb.OleDbCommand
objoledbcommand.Connection = objoledbconnection
objoledbcommand.Connection.Open()
strsql = "select first_name + ' ' + last_name as fullname from
viewpractitioner where pers_org_term_date is null" & _
" and pract_entity_id < '800.033' or pers_org_term_date is
null and pract_entity_id '908.033' order by last_name"
objoledbcommand.CommandText = strsql
objoledbdatareader = objoledbcommand.ExecuteReader
Me.ddlClinician.DataSource = objoledbdatareader
If Not Page.IsPostBack Then
Me.ddlClinician.DataBind()
ddlClinician.Items.Insert(0, " ")
ddlClinician.SelectedIndex = 0
objoledbdatareader.Close()
'objoledbcommand.Connection.Close()
End If
objoledbdatareader.Close()
strsql = "select * from tblMedicalNecessity"
objoledbcommand.CommandText = strsql
objoledbdatareader = objoledbcommand.ExecuteReader
lstMedNecess.DataSource = objoledbdatareader
'If Not Page.IsPostBack Then
lstMedNecess.DataBind()
lstMedNecess.Items.Insert(0, " ")
lstMedNecess.SelectedIndex = 0
'objoledbdatareader.Close()
'objoledbcommand.Connection.Close()
'End If
objoledbdatareader.Close()
objoledbcommand.Connection.Close()
End Sub
Oct 18 '06 #1
1 1084
Is the AutoPostBack property of the ListBox control set to true?

If so, it should be set to false to achive the behavior you desire.

Jason Richmeier

"bindurajeesh" wrote:
I have the following code to populate a list box when my form opens. The
problem is that when I select something from the listbox the page reloads and
goes to the top of the page. I need it to not do that so that I can finish
filling out the form and then hit submit button.

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
strconnectionstring = "Provider=sqloledb;data
source=ntserver3;initial catalog=Family_Consultation_test;user
id=sa;password=guru;"
objoledbconnection = New OleDb.OleDbConnection(strconnectionstring)
objoledbcommand = New OleDb.OleDbCommand
objoledbcommand.Connection = objoledbconnection
objoledbcommand.Connection.Open()
strsql = "select first_name + ' ' + last_name as fullname from
viewpractitioner where pers_org_term_date is null" & _
" and pract_entity_id < '800.033' or pers_org_term_date is
null and pract_entity_id '908.033' order by last_name"
objoledbcommand.CommandText = strsql
objoledbdatareader = objoledbcommand.ExecuteReader
Me.ddlClinician.DataSource = objoledbdatareader
If Not Page.IsPostBack Then
Me.ddlClinician.DataBind()
ddlClinician.Items.Insert(0, " ")
ddlClinician.SelectedIndex = 0
objoledbdatareader.Close()
'objoledbcommand.Connection.Close()
End If
objoledbdatareader.Close()
strsql = "select * from tblMedicalNecessity"
objoledbcommand.CommandText = strsql
objoledbdatareader = objoledbcommand.ExecuteReader
lstMedNecess.DataSource = objoledbdatareader
'If Not Page.IsPostBack Then
lstMedNecess.DataBind()
lstMedNecess.Items.Insert(0, " ")
lstMedNecess.SelectedIndex = 0
'objoledbdatareader.Close()
'objoledbcommand.Connection.Close()
'End If
objoledbdatareader.Close()
objoledbcommand.Connection.Close()
End Sub
Oct 18 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Matt | last post by:
I want to write a ASP page to open/download a file In fileview.jsp, I have the file browse, and when user click submit button, fileview2.asp should open the file. fileview.asp ============...
1
by: Frawls | last post by:
Hi Can any one give me some help with this problem please? Here is the scenario: A user submits page 1 which is a web form. After the form has been submitted they are (redirected) onto...
2
by: Frawls | last post by:
Hi Can any one give me some help with this problem please? Here is the scenario: A user submits page 1 which is a web form.
3
by: David | last post by:
Hello I have a datalist on a webpage which initially displays all the entries in the item view mode. When I select an item to edit it reloads the page and displays the selected item in the...
3
by: Tim Thomas | last post by:
Hi, I am very new to .NET and am in the process of building my first web application. I will briefly describe what i am trying to achieve: I have a system where suppliers register their...
0
by: Tamra | last post by:
Pages run perfectly on any computer with the .Net framework installed. Not so on those that do not. For example. One page uses a sqlDataSourceControl to populate a dropDownList. When an item is...
1
by: umamy | last post by:
Hi, I am writing code to do the followin: - user clicks a link - the page reloads and sets a cookie with a js function in the header. The function reloads the same page with the cookie set and...
11
by: frizzle | last post by:
Hi there, I need a function to prevent a page from being loaded too often too fast. So say, one is only allowed to refresh a single page 5 times in 10 seconds, or 10 times in 5 seconds (or...
2
by: R.A.M. | last post by:
Hello, I am learning ASP.NET. I need to keep some information for a Page-derived object (.aspx page). May I use private members or should I use ViewState of other mechanism? I ask because the...
9
by: mel | last post by:
Hi all, I need a persistent TCP connection with my web server over page reloads. This means that, even if the user goes to a different page (in my domain), I want to keep a TCP connection...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.