This is a migrated thread and some comments may be shown as answers.

Only One Hierarchical grid will display data

4 Answers 100 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 2
Michael asked on 28 Jan 2009, 04:15 PM
I have a setup like this:

<telerik:RadGrid ID="invoiceListGrid" runat="server" GridLines="None" Skin="Default2006"
AutoGenerateColumns
="False" OnNeedDataSource="invoiceListGrid_NeedDataSource"
AllowFilteringByColumn
="True"  AllowPaging="True" AllowSorting="False"
Width
="100%" OnItemCommand="invoiceListGrid_ItemCommand"
AllowMultiRowSelection
="True" ShowStatusBar="true"
 
<MasterTableView DataKeyNames="BillByPeriodID,LeaseID,YPID" PageSize="50" HierarchyLoadMode="Client"
 
<DetailTables> 
<telerik:GridTableView AllowSorting="false" AllowFilteringByColumn="false"
DataKeyNames
="BillByPeriodID" DataSourceID="odsInvoiceDetails" Width="100%"
<ParentTableRelation> 
<telerik:GridRelationFields DetailKeyField="BillByPeriodID" MasterKeyField="BillByPeriodID" /> 
</ParentTableRelation> 
<Columns>...</Columns> 
</telerik:GridTableView> 
 
<telerik:GridTableView AllowSorting="false" AllowFilteringByColumn="false"
DataKeyNames
="LeaseID,YPID" DataSourceID="odsOtherDetails" Width="100%"
<ParentTableRelation> 
<telerik:GridRelationFields DetailKeyField="LeaseID" MasterKeyField="LeaseID" /> 
<telerik:GridRelationFields DetailKeyField="YPID" MasterKeyField="YPID" /> 
<Columns>...</Columns> 
</telerik:GridTableView> 
                         
</DetailTables> 
 
</MasterTableView> 
 
<ClientSettings AllowExpandCollapse="True"
</ClientSettings> 
 
</telerik:RadGrid> 
 
<asp:ObjectDataSource ID="odsInvoiceDetails" runat="server"  
TypeName="Blah.BLL.Invoice"  
SelectMethod="GetInvoiceByID"
<SelectParameters> 
<asp:SessionParameter Name="invoiceID" sessionField="BillByPeriodID" Type="Int32" Direction="input" /> 
</SelectParameters> 
</asp:ObjectDataSource> 
             
<asp:ObjectDataSource ID="odsOtherDetails" runat="server"  
TypeName="Blah.BLL.Other"  
SelectMethod="GetPeriodSummaryByLeaseID"
<SelectParameters> 
<asp:SessionParameter Name="leaseID" sessionField="LeaseID" Type="Int32" Direction="input" /> 
<asp:SessionParameter Name="ypId" sessionField="YPID" Type="Int32" Direction="input" /> 
</SelectParameters> 
</asp:ObjectDataSource> 

My problem is that only the first sub-grid shows any data.  In fact, the second sub-grid never even fires the SelectMethod of the ObjectDataSource to which it has been assigned.  This has been confirmed by placing a breakpoint in business class "Blah.BLL.Other".

Why is my first sub-grid being loaded with data as expected, and the second (same level -- level 2) is being ignored?

Thanks,

Mike

4 Answers, 1 is accepted

Sort by
0
Michael
Top achievements
Rank 2
answered on 28 Jan 2009, 05:00 PM
Could this be related to the fact that in my master table I am using the NeedDataSource event to bind data in the codebehind, but with my sub-grids I am declaritively assigning the datasource using the DataSourceID property?
0
Shinu
Top achievements
Rank 2
answered on 29 Jan 2009, 08:23 AM
Hi Michael,

I have found the following forum link which explains how to implement Hierarchical Grid with ObjectDataSource. You may give a try with sample application provided by telerik and see if it helps to some extent.
RadGrid Hierarchy with an objectdatasource

Shinu
0
Michael
Top achievements
Rank 2
answered on 29 Jan 2009, 01:14 PM
Hi Shinu,

Thanks for the lead, but the example you reference is no different from my example but for two possible differences:

1. The example uses a declarative ODS for the master table and I bind at runtime programatically.  I am having no problems with returning and displaying records from this master table.  In fact, I am having no problem getting records from the first child grid.
2. The example uses "autogeneratecolumns=true" for all the tables.  I cannot do this.  But,  iahve tried it on the problem table (the second of the two children) and, interestingly, instead of getting nothing I got data from the master table!

I am obviously missing something obvious here as no one else seems to complain of this issue.

Thanks.
0
Michael
Top achievements
Rank 2
answered on 04 Feb 2009, 03:35 PM
Bump
Tags
Grid
Asked by
Michael
Top achievements
Rank 2
Answers by
Michael
Top achievements
Rank 2
Shinu
Top achievements
Rank 2
Share this question
or