Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
180
WebHierarchicalDatagrid - LoadOnDemand with Objects
posted

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"

 

/>

 

 

 

 

 

 

</ig:BoundDataField

 

>

 

 

 

 

 

 

</Columns

 

>

 

 

 

 

 

 

<Behaviors

 

>

 

 

 

 

 

 

<ig:EditingCore Enabled

 

="false">

 

 

 

 

 

 

</ig:EditingCore

 

>

 

 

 

 

 

 

</Behaviors

 

>

 

 

 

 

 

 

</ig:Band

 

>

 

 

 

 

 

 

</Bands

 

>

 

 

 

 

 

 

<Columns

 

>

 

 

 

 

 

 

<ig:BoundDataField DataFieldName="ConferenceDateTime" DataFormatString="{0:G}"

 

 

 

Key

="ConferenceDateTime">

 

 

 

 

 

 

<Header Text="Date/Time"

 

/>

 

 

 

 

 

 

</ig:BoundDataField

 

>

 

 

 

 

 

 

<ig:BoundDataField DataFieldName="HostName" Key

 

="HostName">

 

 

 

 

 

 

<Header Text="Inputted Host"

 

/>

 

 

 

 

 

 

</ig:BoundDataField

 

>

 

 

 

 

 

 

<ig:BoundDataField DataFieldName="HostPID" Key

 

="HostPID">

 

 

 

 

 

 

<Header Text="Verified Host"

 

/>

 

 

 

 

 

 

</ig:BoundDataField

 

>

 

 

 

 

 

 

<ig:BoundDataField DataFieldName="HostTelephone" Key

 

="HostTelephone">

 

 

 

 

 

 

<Header Text="Host Phone"

 

/>

 

 

 

 

 

 

</ig:BoundDataField

 

>

 

 

 

 

 

 

<ig:BoundDataField DataFieldName="ClientMatter" Key

 

="ClientMatter">

 

 

 

 

 

 

<Header Text="C/M #"

 

/>

 

 

 

 

 

 

</ig:BoundDataField

 

>

 

 

 

 

 

 

<ig:BoundDataField DataFieldName="Status" Key

 

="Status">

 

 

 

 

 

 

<Header Text="C/M Name"

 

/>

 

 

 

 

 

 

</ig:BoundDataField

 

>

 

 

 

 

 

 

<ig:BoundDataField DataFieldName="VerifiedHostName" Hidden="true"

 

 

 

Key="VerifiedHostName" Width

="0%">

 

 

 

 

 

 

<Header Text="VerifiedHostName"

 

/>

 

 

 

 

 

 

</ig:BoundDataField

 

>

 

 

 

 

 

 

</Columns

 

>

 

 

 

 

 

 

<Behaviors

 

>

 

 

 

 

 

 

<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">

 

 

 

 

 

 

<Behaviors

 

>

 

 

 

 

 

 

<ig:CellEditing CellEditingClientEvents-ExitingEditMode="whdgUnreconciled_ExitingEditMode"

 

 

 

EditModeActions-EnableF2="true" EditModeActions-EnableOnActive="true"

 

 

EditModeActions-MouseClick="Double" Enabled="true" EnableInheritance

="true">

 

 

 

 

 

 

<ColumnSettings

 

>

 

 

 

 

 

 

<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"

 

/>

 

 

 

 

 

 

</ColumnSettings

 

>

 

 

 

 

 

 

<CellEditingClientEvents ExitingEditMode="whdgUnreconciled_ExitingEditMode"

 

/>

 

 

 

 

 

 

<EditModeActions EnableOnActive="True"

 

/>

 

 

 

 

 

 

</ig:CellEditing

 

>

 

 

 

 

 

 

</Behaviors

 

>

 

 

 

 

 

 

</ig:EditingCore

 

>

 

 

 

 

 

 

<ig:Activation Enabled

 

="true">

 

 

 

 

 

 

</ig:Activation

 

>

 

 

 

 

 

 

</Behaviors

 

>

 

 

 

 

 

 

<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.