Using Controls Version=10.2.20102.1011
I have a WHDG I am binding from a dataset stored in viewstate.
When the page loads I retrieve some records from my database into a dataset, which I then assign to ViewState("DS"). Then, in page_prerender I bind the ViewState("DS") to the datasource property of the WHDG followed by a databind. Grouping, sorting and display of the grid seems to be functioning properly at this point. The ViewState approach allows the grid to operate properly for grouping, etc.
I also have a list box that will contain a set of data filters used to query select records from my database into a dataset. When one of these listbox items is clicked, I do an autopostback, retrieve data using a dataset into the ViewState("DS") statebag. The pre-render step then attempts to assign the ViewState("DS") to the WHDG the same as at first load, followed by another databind.
Its worth noting that the listbox initiated query returns a subset of the data returned at first load. Just does a top(2) but otherwise identical to the first dataset in shape and scheme.
The second databind generates the following error message;
Unable to cast object of type Infragistics.Web.UI.Framework.Data.DataRecord to type System.Web.UI.IHierarchyData.
However, the queried results then appear in the WHDG, like the first query except that the fonts and column sizing seem to have been messed with.
Any thoughts?
The answer is;
before reassigning a new dataset do the following;
whdg.GridView.ClearDataSource()
I found this in another post having to do with all things changing a cells color and some other binding issues. RADO was the TEAM member who suggested this in that post.