Hi..
I am using 2 Dropdowns in VB.net.In page loading i ll get the values from DB for the 1st dropdown for the second one i want to filter the values based on the first dropdown. can u tell me how to get the value for the second dropdown
Hi..
I am using 2 Dropdowns in VB.net.In page loading i ll get the values from DB for the 1st dropdown for the second one i want to filter the values based on the first dropdown. can u tell me how to get the value for the second dropdown
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Mamta MRank #268 · 9.4K reputationPosted Mar 9, 2009, 12:12 AM EDT
Hi,
Your question doesn't seem very clear. If you mean that, after a user selects a value in the first dropdown, you want the second dropdown to have filtered values based on that user selection, then that's quite easy and possible. All you need to do is get the selected element's index or value and construct a query (SELECT) statement with criteria based on the first dropdown selection to populate the second one.
For eg, for a listbox, you will use the SelectedItem property to retrieve the selected value.
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim selectedval = ListBox1.SelectedItem
. . .
End Sub
Hope that helps.
Regards,
Mamta