"pageload" is reseting my DropDownLIst

yaniv

Well-known member
Joined
Apr 15, 2002
Messages
162
Location
israel
I built a dropdownlist that supposed to give a string to a query when the user press a bottun.

The problem is that the list allways gives the same string (the first in the list). I think that the "pageload" procedure is reseting the dropdownlist. do you have an idea how to solve it?
 
Are you checking the IsPostBack property when the user submits to tell if this is the first load (populate dropdown) or a postback(grab the selection)? Lookup IsPostBack and see if that helps.
 
I include the code:

<code>
Dim strsql As String
If check.Checked = True Then
strsql = "SELECT * from main WHERE subject = " & subject.SelectedItem.Text & ""
If musag.Text <> "" Then strsql = strsql & " AND musag = " & musag.Text & ""
Else
strsql = "SELECT * FROM main WHERE musag = " & musag.Text & " "
End If
</code>

the strsql string is always the same value, doestmetter what the user chosed in the dropdownlist.
 
You have to check the PostBack like what quwiltw said, something like this

If IsPostBack Then
your process...
Else
load record to your dropdownlist
End If

If not, your dropdownlist wil always reset
 
I cant underatand it, what should i put in the "your process", the building of the query or the other way around?
 
"your process" is where you building the query string, because "IsPostBack" = true mean user was trigger the event or submit the form.
 
Back
Top