Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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?

  • Leaders
Posted
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.
--tim
Posted

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.

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...