I have a RadGrid in which the contents and column settings are dictated by a dropdownlist.
When a dropdownlist item is selected, the grid's data and various configurable grid settings (like reordering, sorting, filtering, and column widths) are loaded from the database. The user can then manipulate various settings client-side and optionally save them out again.
- When an Ajax postback occurs, like refreshing the grid, the settings are maintained by the viewstate as usual. For instance, if the user has changed the column width, that is maintained, no problem.
- However, when the dropdownlist selection changes, causing a totally new set of data and settings to be loaded, any viewstate settings for the old data must be abandoned. The solution we tried was overriding LoadViewState to do nothing in this case, but we get a NullReferenceException from RadGrid.LoadClientState if a column is resized and then the dropdownlist selection is changed. If no columns have been resized, it works. Also, column-resizing seems to be the only setting for which the exception happens (that I've found so far).
Do you have any suggestions here, either a better way to clear the grid's viewstate on a new data load, or perhaps a workaround for the resizing issue?
Thanks very much,
Eve