Greetings,
I am developing a WHDG on a visual webpart on sharepoint 2010. The datasource is set from a dataset at runtime. I have created a child band and made a templatefield containing a linkbutton within the child band (At design time). Everything works perfect, but when I expand the the rows, i am getting viewstate error. This is due to the tempatefield in the child records are not rendered initially, but they will be rendered on demand.
Hence I made to expand any one record at the page load so that one child record is rendered with this templated field (This is not the behavior what I wanted, but to check the issue).
'To expand one row initially
If Not Page.IsPostBack Then Dim rcount As Integer = Me.WebHierarchicalDataGrid1.GridView.Rows.Count For i As Integer = 0 To rcount - 1 If Me.WebHierarchicalDataGrid1.GridView.Rows(i).IsEmptyParent = True Then Me.WebHierarchicalDataGrid1.GridView.Rows(i).Expanded = True Me.WebHierarchicalDataGrid1.GridView.Rows(i).ExpandChildren() Exit For End If Next End If
Now there is no view state error and i can expand any row without problem. But how can I work if i don't pre-expand one row at the page load? Anyone can help me on this issue?
Thanks,
Rajesh
Hi Rajesh,
It has been some time since your post, however in case you still need assistance I would be glad to help.
In this scenario I would suggest that you either define your band and column structure from the markup (and perhaps set InitialDataBindDepth to -1), or alternatively you can use manual LoadOnDemand to create a customized column structure for your child bands. A sample demonstrating manual load on demand is available at:
http://samples.infragistics.com/aspnet/Samples/WebHierarchicalDataGrid/Performance/ManualLoadOnDemand/Default.aspx?cn=hierarchical-data-grid&sid=0f1ddcc5-07c6-4406-a1f2-ed2d15c40279
Additional info regarding load on demand is available at:
http://help.infragistics.com/NetAdvantage/ASPNET/2011.2/CLR4.0/?page=WebHierarchicalDataGrid_Load_On_Demand.html
Please do not hesitate to contact me if you have any questions.