Reputation: 12674
I have a DataSource assigned to a DropDownList (DD2) that has a WHERE clause specified by the contents of another DropDownList (DD1). When I change the DD1, however, that DD2 does not reload its data. Is there a way to get DD2 to reload when DD1 is changed?
I've tried:
protected void DD1_SelectedIndexChanged(object sender, EventArgs e)
{
DD2.DataBind();
}
But this appears to do nothing.
Upvotes: 0
Views: 46
Reputation: 15797
Move the logic of setting the DD2 DataSource
and DD2 DataBind()
to a new function and call that instead. Your problem is likely that the datasource is getting incorrectly set.
protected void DD2Bind()
{
DD2.DataSource = //fetch data source
DD2.DataBind();
}
protected void DD1_SelectedIndexChanged(object sender, EventArgs e)
{
DD2Bind();
}
Upvotes: 1