Avatar of jkeagle13

asked on 

DropDownList VB.NET / ASP.NET DataBind() - Dynamic Refresh Problem


I have two AccessDataSources. The second is a query based on the selection made in the first DropDownList box. The first box acts as a filter.

The user will have occasion to change the first DropDownList box and will need the different set of data that the query provides.

If I create a button and add the code: DropDownList2.DataBind() it works perfectly, populating the DropDownList2 with the data based on whatever the changed filter is.

However, I am aiming for this to be as user-friendly as possible which means avoiding excess buttons.

What I would like is to have the DropDownList2.DataBind() called when the DropDownList1 is changed. I have added code to methods such as:

Private Sub DropDownList1_SelectedIndexChanged

No avail, however. The code correctly re-populates if the DataBind code is called from the button; however, I have not been able to find a way to have it called when the first DropDownList changes. I have tried all sorts of variations of the code and - nothing. No changes.

How can I get it to call that same code automatically when the first DropDownList value changes, as opposed to making them push a button?

Using VB.NET

.NET ProgrammingVisual Basic ClassicASP.NET

Avatar of undefined
Last Comment

8/22/2022 - Mon