Reputation: 1109
I have some drop down lists on a page which get their SelectedValue from a session variable. This allows the value of the dropdowns to be saved across multiple pages.
Problem is the dropdown selected value is being used as a parameter to a separate data source on the page.
If I try to set the dropdown list's value before the dropdown list is databound, I get an exception because the dropdown list has not been populated yet. If I try to set the dropdown list's value too late, the other data source will be executed with the original value of the dropdown list instead of it's current.
Is there a proper order to handle these events in?
Upvotes: 0
Views: 577
Reputation: 23094
Don't do binding on the data source until it has had time to get the value from the dropdown. Add an event handler to the dropdown's DataBound
event. In that event handler you can bind on the data source, using the selected value of the dropdown.
Upvotes: 1