Version 10.3.20103.1013, .NET 4
I'm binding my WHGD to a collection of custom business objects. Each has a member collection which is lazy loaded. I am trying to bind my child band to the member collection using Load On Demand.
1. If I set my initaldatabinddepth = -1, there is no postback and therefore my RowIslandsPopulating method does not fire.
2. If I set my initialdatabinddepth = 0, the postback happens and the first child band load works, but on subsequent attempts to load other instances of the child band, I receive an AJAX/JavaScript error saying that the viewstate is corrupted.
Here is the markup for the WHGD:
<
ig:WebHierarchicalDataGrid ID="whdgUnreconciled" runat="server" AutoCRUD="false"
AutoGenerateBands="False" AutoGenerateColumns="False"
DataKeyFields="ConferenceID" EnableDataViewState="false" Height="350px"
InitialDataBindDepth="-1" OnColumnSorted="whdgUnreconciled_ColumnSorted"
OnPageIndexChanged="whdgUnreconciled_PageLocationChanged"
onprerender="whdgUnreconciled_PreRender" OnRowUpdating="whdgUnreconciled_RowUpdating"
Width="100%"
OnRowIslandsPopulating
="whdgUnreconciled_RowIslandsPopulating">
Bands
>
<ig:Band AutoGenerateColumns="False" datamember
="EmptyAttendees">
<Columns
<ig:BoundDataField DataFieldName="AttendeeName" Key
="AttendeeName">
<Header Text="Attendee Name"
/>
</ig:BoundDataField
<ig:BoundDataField DataFieldName="AttendeeDuration" Key
="AttendeeDuration">
<Header Text="Duration"
</Columns
<Behaviors
<ig:EditingCore Enabled
="false">
</ig:EditingCore
</Behaviors
</ig:Band
</Bands
<ig:BoundDataField DataFieldName="ConferenceDateTime" DataFormatString="{0:G}"
Key
="ConferenceDateTime">
<Header Text="Date/Time"
<ig:BoundDataField DataFieldName="HostName" Key
="HostName">
<Header Text="Inputted Host"
<ig:BoundDataField DataFieldName="HostPID" Key
="HostPID">
<Header Text="Verified Host"
<ig:BoundDataField DataFieldName="HostTelephone" Key
="HostTelephone">
<Header Text="Host Phone"
<ig:BoundDataField DataFieldName="ClientMatter" Key
="ClientMatter">
<Header Text="C/M #"
<ig:BoundDataField DataFieldName="Status" Key
="Status">
<Header Text="C/M Name"
<ig:BoundDataField DataFieldName="VerifiedHostName" Hidden="true"
Key="VerifiedHostName" Width
="0%">
<Header Text="VerifiedHostName"
<ig:Paging Enabled="true" FirstPageText="First" LastPageText="Last"
PagerAppearance="Bottom" PagerMode="NumericFirstLast" PageSize="20"
QuickPages="10"
<ig:Sorting Enabled="true" EnableInheritance="True" SortingMode
="Single">
<ColumnSettings
<ig:SortingColumnSetting ColumnKey="ConferenceDateTime"
<ig:SortingColumnSetting ColumnKey="HostPID"
<ig:SortingColumnSetting ColumnKey="HostName"
<ig:SortingColumnSetting ColumnKey="Status"
<ig:SortingColumnSetting ColumnKey="HostTelephone" Sortable="False"
<ig:SortingColumnSetting ColumnKey="ClientMatter" Sortable="False"
<ig:SortingColumnSetting ColumnKey="VerifiedHostName" Sortable="False"
</ColumnSettings
</ig:Sorting
<ig:EditingCore AutoCRUD="false" Enabled="true" EnableInheritance
="true">
<ig:CellEditing CellEditingClientEvents-ExitingEditMode="whdgUnreconciled_ExitingEditMode"
EditModeActions-EnableF2="true" EditModeActions-EnableOnActive="true"
EditModeActions-MouseClick="Double" Enabled="true" EnableInheritance
<ig:EditingColumnSetting ColumnKey="ConferenceDateTime" ReadOnly="true"
<ig:EditingColumnSetting ColumnKey="HostPID" EditorID="EmployeeProvider"
ReadOnly="false"
<ig:EditingColumnSetting ColumnKey="HostName" ReadOnly="true"
<ig:EditingColumnSetting ColumnKey="HostTelephone" ReadOnly="true"
<ig:EditingColumnSetting ColumnKey="ClientMatter" ReadOnly="false" EditorID="CMProvider"
<ig:EditingColumnSetting ColumnKey="Status" ReadOnly="true"
<CellEditingClientEvents ExitingEditMode="whdgUnreconciled_ExitingEditMode"
<EditModeActions EnableOnActive="True"
</ig:CellEditing
<ig:Activation Enabled
</ig:Activation
<EditorProviders
<ig:DropDownProvider ID
="EmployeeProvider">
<EditorControl ID="edcHost" runat="server" DisplayMode="DropDown"
TextField="ShortDisplayName" ValueField
="PID">
<DropDownItemBinding TextField="ShortDisplayName" ValueField="PID"
</EditorControl
</ig:DropDownProvider
<ig:MaskEditorProvider ID
="CMProvider">
<EditorControl ID="mskCM" DataMode="AllText" InputMask="######.####"></EditorControl
</ig:MaskEditorProvider
</EditorProviders
</ig:WebHierarchicalDataGrid
Note that "EmptyAttendee " is just a an empty version of the collection which I load on my RowIslandsPopulating.
Here is my code behind:
protected
void whdgUnreconciled_RowIslandsPopulating(object sender, ContainerRowCancelEventArgs e
)
{
e.Cancel = true
;
TeleconferenceRecords calls = (TeleconferenceRecords)Session["UnreconciledCalls"
];
TeleconferenceRecord call = calls.Find(c => c.ConferenceID == (int)e.Row.DataKey[0
]);
ContainerGrid grdChild = new ContainerGrid
();
grdChild.AutoGenerateColumns = false
BoundDataField colName = new BoundDataField(false
);
colName.DataFieldName = "AttendeeName"
colName.Key = "AttendeeName"
colName.Header.Text = "Attendee"
grdChild.Columns.Add(colName
BoundDataField colDuration = new BoundDataField(false
colDuration.DataFieldName = "AttendeeDuration"
colDuration.Key = "AttendeeDuration"
colDuration.Header.Text = "Duration"
grdChild.Columns.Add(colDuration
e.Row.RowIslands.Add(grdChild
grdChild.DataSource = call.Attendees
grdChild.DataBind
whdgUnreconciled.DataSource = calls
}
protected void whdgUnreconciled_PreRender(object sender, System.EventArgs e
foreach (ContainerGridRecord row in whdgUnreconciled.GridView.Rows
row.IsEmptyParent = true
Thanks for your help.
Hi cwaldmann,
From what I can see, you are adding columns to your grid in your RowIslandsPopulating handler. I suggest trying to add these columns as a band on the grid on !isPostBack or from the markup (as the reason for the viewstate corruption might be that you are adding columns when each row island needs to be populated).
Please tell me if this helps.
Best Regards,Petar IvanovDeveloper Support EngineerInfragistics, Inc.http://www.infragistics.com/support
I'm not sure that this answer makes sense. Every example of LoadOnDemand I've seen uses the RowIslandsPopulating event to build the child band and then add it to grid as a child. Is there an example of LoadOnDemand that I am missing?
Note that the goal here is to only load the collection bound to the child band when a user opens up the parent item. This is a seperate sql call/object build based on the key of the parent.
My apologies as my previous post is indeed inaccurate.
I am attaching a sample which you might find useful that demonstrates a hierarchical grid using manual load on demand.
Regarding your implementation, please note that container grids should first be added to the respective row collection and their properties should be modified afterwards, for instance:
protected void WebHierarchicalDataGrid1_RowIslandsPopulating(object sender, ContainerRowCancelEventArgs e) { //Note that the childGrid properties should be set AFTER adding it to the rowIsland collection e.Cancel = true; ContainerGrid childGrid = new ContainerGrid(); e.Row.RowIslands.Add(childGrid); childGrid.AutoGenerateColumns = true; childGrid.DataSource = someDataSource; }
I recommend that you consider updating to the newest service release for 10.3, as since build 1013 there have been resolved issues regarding LOD in the WHDG.
Please let me know if this helps.
Hi Petar,
i have an issue in HierarchicalDataGrid
i am using Automatic load on demand for populating 69 records in root band and around 700 records in total in chlid band...
chlid band loading getting delayed when mutiple chlid bands are opened.
Needed solution for loading all the chlid bands asynchronously ...(for loading chlid band faster)
is there any way to load data asynchronously or any other way
With Regards,
V.G.Selvakumar
Hi vgselva,
The following article contains useful suggestions for optimizing the performance of the WHDG.
https://www.infragistics.com/community/blogs/b/engineering/posts/webhierarchicaldatagrid-why-the-response-gets-bigger-with-every-ajax-request
As far as I can understand you are using load on demand in your implementation, but in case you wish to know more, detailed information is available in our documentation:
help.infragistics.com/NetAdvantage/ASPNET/2011.1/CLR4.0/?page=WebHierarchicalDataGrid_Load_On_Demand.html
Please let me know if you have any questions.