Running Visual Studio 2010/.NET 4.0/Infragistics Suite 10.2.WebHierarchicalDataGrid defined with only ID, runat, height, showfooter, and width in the .aspx file.I have a system.data.dataset defined with a few datatables and relations.
Set IniitalDataBindDepth = 0, InitialExpandDepth = 0, DataMember, Datasource, AutoGenerateBands = true, AutoGenerateColumns = true and then call Grid1.DataBind and the web form works showing the arrows so I can drill down into child rows, click on them, they do the post back, and everything works.
IF, however, instead of doing AutoGenerateBands and AutoGenerateColumns (set both to false), I fill in the Bands and Columns information through code, the page displays okay initially. When I hit one of the arrows to drill in, however, I get: [InvalidOperationException]: LoadViewState_Exception with a huge stack trace.
I get this error really no matter what I do with the grid from then on. Whether it's trying to drill into child records or sort it by clicking on column heading or anything, it gives the same errors.
Thanks for the fast reply... !!!
I have digged a bit more into this and it finally started to work when I used the property DataSourceID instead of DataSource... Don't ask me why but thats what happened...
/Henrik
I can't really break out the code without it being really confusing due to the complexity of what our web project is doing and all the custom objects we have holding various information.
But basically, here's what I do:
I go ahead and setup the "Band" structure during initially loading the information into the grid. I do NOT add the columns at this point. I set DtaaMember, Key, DataKeyFields, and set AutoGenerateColumns = False on the main Grid itself. (Remember, the "Grid" is the "Primary Band").
Then, add any Child Bands for the grid. Make sure you add them to their parent's "Bands" collection BEFORE doing any grandchild bands. That's what was killing me.Dim oChildBand as new gridcontrols.bandme.Grid1.Bands.Add(oChildBand)<Add Grandchildren Here>
To get the Columns into the grid, I added an Event Handler on Grid1.InitializeBand. In there, I do:IF e.Band.Columns.Count <= 0 Then <create band columns here I set dataFieldName, DataFormatString, Header.Text, Hidden, Key, VisibleIndex, Width on a new GridControls.BoundDataField object and then add it to the e.Band.Columns collection > End If
If you have a minute or two over, please send in a small code snippet showing the code that solved the error. I am sitting with a similar task at the moment (manually adding bands and columns) and I haven't got it to work yet...
For anyone who runs across this, I finally got the code right. I had to make sure to add the "Band" to it's parent band before adding the columns to the band. Then everything started working properly.