I have a form where there are two dropdown lists that are populated from the same dataset, so their values should be equal. I have the OnSelectedIndexChanged event in code and the AutoPostBack set to true for the second drop down. The behavior expected is that when a user selects an item from the second dropdown, the first should change to what was selected in the second. My code in the event looks like this:
if(!ddl1.SelectedValue.Equals(ddl2.SelectedValue)
{
ddl1.SelectedValue = ddl2.SelectedValue;
}
The OnSelectedIndexChanged event also contains code that rebinds the datagrid on the bottom of the page based on the selection of the second dropdownlist. Long story short, the datagrid changes, but the first dropdown does not change its value. It doesn’t seem like a postback should limit what would change on a page, so what am I missing here?
1 Answer