I have a GridView with a DropDownList on each row. (The items in the DropDownList are the same for everyone.) I have a DropDownList "ddlView" outside of the GridView, which is used to filter the available options in other DropDownLists. The default selection for ddlView is not a filter.
When the user selects a new value for ddlView, any selected values โโin other DropDownLists disappear if they are not one of the values โโpresent after applying the filter. In this case, I would like the previous selected value to be still present and selected.
What is the best way to do this?
The previously selected values โโare available during the postback, but seem cleared after calling DataBind () in the GridView, so I can not determine their previous value in the method in which they are filled (RowDataBound event).
My best idea is to manually store this information in an object or collection during postback and reference it later during data binding events.
Is there a better way?
source share