andycharger Posted August 4, 2003 Posted August 4, 2003 I have a dropdown list on my page and a submit button. However, When I change my selection and press submit, it always takes the first value out of the list! e.g. I have a list with 3 entries, Horsebox, Trailer and Car Like this: Horsebox Trailer Car I select Car from the drop down and press Submit. Then the page passes through the name in the url i.e Department_Id="Car" However, it always passes through the first value in the list and this is despite me setting the following code: Sub Go_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Go.Click Dim strSelected As String strSelected = oDeps.SelectedItem.Text Response.Redirect("trainingplans.aspx?dept_id=" & oDeps.SelectedItem.Text) End Sub any ideas why it is not taking the value I selected in the drop down box? Quote
Administrators PlausiblyDamp Posted August 4, 2003 Administrators Posted August 4, 2003 Are you populating the list in your form_load event? If so you will need to check Page.IsPostBack - if it's true don't reinitalize the controls. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
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.