Hallo, this is my first post and sorry for my english (google-translate for ever)..
There are a problem with Load on Demand wenn i built it on runtime.
I got an 2-level WebHierarchicalDataGrid, 2 SqlDataSources and WebHierarchicalDataSource with default properties.
I make binding at runtime, in WebHierarchicalDataGrid_Init Funktion.
If i set InitialDataBindDepth="-1" it works properly (no Load on Demand).
If i set InitialDataBindDepth="0", after expanding of ParentRow is result of ChildDataView duplicated.
Here is my Code:
Protected Sub hdgAgentWork_Init(sender As Object, e As EventArgs) Handles hdgAgentWork.Init
' Create the view
Dim viewOfDay As New Infragistics.Web.UI.DataSourceControls.DataView()
Dim viewOfWeek As New Infragistics.Web.UI.DataSourceControls.DataView()
' Set the required properties
viewOfDay.ID = "dsAgentWorkByDay_View"
viewOfDay.DataSourceID = Me.dsAgentWorkByDay.ID
viewOfWeek.ID = "dsAgentWorkByWeek_View"
viewOfWeek.DataSourceID = Me.dsAgentWorkByWeek.ID
' add Views to HierarchicalDataSource
hdsAgentWork.DataViews.Add(viewOfDay)
hdsAgentWork.DataViews.Add(viewOfWeek)
' create Relations
Dim dr As New Infragistics.Web.UI.DataSourceControls.DataRelation()
dr.ParentDataViewID = viewOfWeek.ID
dr.ParentColumns = New String() {"AW_AGENTID"}
dr.ChildDataViewID = viewOfDay.ID
dr.ChildColumns = New String() {"AW_AGENTID"}
Me.hdsAgentWork.DataRelations.Add(dr)
hdgAgentWork.DataKeyFields = "AW_AGENTID"
hdgAgentWork.DataSourceID = hdsAgentWork.ID
End Sub
It's wrong to do that in WebHierarchicalDataGrid_Init Funktion ?
Hello pobo001,
If you need any further assistance on the matter please do not hesitate to ask.
Hi pobo001,
Thank you for posting in the community.
I have been reading through your post and the code you have provided seems correct to me. In order to be able to provide more insight, I would need a small isolated sample, demonstrating this behavior. Also, I would suggest that you bind the grid on page load.
Please let me know if you have any other questions.