yaniv Posted April 15, 2003 Posted April 15, 2003 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? Quote
Leaders quwiltw Posted April 15, 2003 Leaders Posted April 15, 2003 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. Quote --tim
yaniv Posted April 15, 2003 Author Posted April 15, 2003 I found it and i think it is related to the problem, but i don't know how to sole it. Quote
yaniv Posted April 15, 2003 Author Posted April 15, 2003 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, does'tmetter what the user chosed in the dropdownlist. Quote
bungpeng Posted April 15, 2003 Posted April 15, 2003 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 [/Quote] If not, your dropdownlist wil always reset Quote
yaniv Posted April 15, 2003 Author Posted April 15, 2003 I can't underatand it, what should i put in the "your process", the building of the query or the other way around? Quote
bungpeng Posted April 16, 2003 Posted April 16, 2003 "your process" is where you building the query string, because "IsPostBack" = true mean user was trigger the event or submit the form. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.