Hello Adam,
To set up the second level in the hierarchy for such a data source as this, you need to add another child band to the grid's bands collection and set its DataMember property to the IList property name. So the grid mark up could look like following:
<ig:WebHierarchicalDataGrid ID="whdg1" runat="server"
AutoGenerateColumns="false" AutoGenerateBands="false" InitialExpandDepth="0" DataKeyFields="Id"
InitialDataBindDepth="0" Height="380px" Width="700px">
<Columns>
<ig:BoundDataField DataFieldName="LastName" Key="LastName" Header-Text="Last Name" />
<ig:BoundDataField DataFieldName="FirstName" Key="FirstName" Header-Text="First Name" Width="230px" />
<ig:BoundDataField DataFieldName="HealthCardNumber" Key="HealthCardNumber" Header-Text="OHIP" Width="150px" />
<ig:BoundDataField DataFieldName="DOB" Key="DOB" Header-Text="DOB" Width="80px" />
</Columns>
<Bands>
<ig:Band DataMember="ClientCases" AutoGenerateColumns="false" Key="ClientCases" DataKeyFields="ClientCaseId">
<ig:BoundDataField DataFieldName="ClientCaseId" Key="ClientCaseId" Header-Text="ClientCaseId" />
<ig:BoundDataField DataFieldName="Name" Key="Name" Header-Text="Name" />
</ig:Band>
</Bands>
</ig:WebHierarchicalDataGrid>
Alex,
Thanks for the quick reply, I now get an arrow to indicate that a parent has a child, however when I click on the arrow to expand the child I get an error message that says: Runtime Exception: no child grid script descriptors are available!
Huh? Please help...
Thanks again,
Adam
Adam,
Because of loadondemand and hierarchical nature of the control its data source must be available on every post back so the grid could mine into the data source and bind to correct data island when requested.
I see that you are binding to your data on a button click. If the size of your data is not too big you can instruct the grid to bind to the full hierearchy by setting InitialDataBindDepth to -1. That way on expaning a row the grid will not go back to server for more data.
Or the fact that the grid was bound needs to be remembered and on the next page_load the same data source needs to be reassigned to the grid's DataSource property.
I followed your Idea of initial band depth to -1 but I see no of exceptions like key not found.
Do you have any sample where it shows how to bind to WebHierarchicalDataGrid with custom objects in code behind and NOT BY DATASET and ACCESS THRU ASPX.
Am not looking for WebHierarchicalDataGridDataSource objects defined in ASPX pages.
We have a WCF service which provides the required objects and have their own heirarchy.
Can you show an example where it is done with one or two levels of heirarchy and summaries for the internal bands.
Thanks,
Arif