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

Help with basic 3 level RadGrid

2 Answers 88 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 29 Jul 2014, 02:47 PM
Hello,

I'm trying to implement a pretty simple 3 level RadGrid(Master + 2 Detail) and no matter what I try I can't get it to display the 3rd level.  The first two levels expand properly, but the third just expands blank.  I'm sure I'm just missing something simple but wasn't sure where to look.  

Here's my Code:

01.<telerik:RadGrid ID="RadGrid1" runat="server" CellSpacing="0" GridLines="None" ShowFooter="True" Skin="Forest" DataSourceID="SqlDataSourceRegion">
02.                <MasterTableView AutoGenerateColumns="true" DataKeyNames="region_id" ShowFooter="False">
03.                    <DetailTables>
04.                        <telerik:GridTableView runat="server" DataKeyNames="region_id" DataSourceID="SqlDataSourceCommunity" ShowFooter="False" AllowMultiColumnSorting="True" AllowSorting="True">
05.                            <DetailTables>
06.                                <telerik:GridTableView runat="server" DataKeyNames="community_id" DataSourceID="SqlDataSourceHomes" AllowSorting="True">
07.                                    <ParentTableRelation>
08.                                        <telerik:GridRelationFields DetailKeyField="community_id" MasterKeyField="community_id" />
09.                                    </ParentTableRelation>
10.                                </telerik:GridTableView>
11.                            </DetailTables>
12.                            <ParentTableRelation>
13.                                <telerik:GridRelationFields DetailKeyField="region_id" MasterKeyField="region_id" />
14.                            </ParentTableRelation>
15.                        </telerik:GridTableView>
16.                    </DetailTables>
17.                </MasterTableView>
18.            </telerik:RadGrid>
19.        </div>
20.        <br />
21.        <asp:SqlDataSource ID="SqlDataSourceRegion"
22.            ConnectionString="<%$ ConnectionStrings:LEAD %>"
23.            ProviderName="System.Data.SqlClient"
24.            SelectCommand="SELECT region_id, region_name FROM all_communities_regions_types " runat="server"></asp:SqlDataSource>
25. 
26.         <asp:SqlDataSource ID="SqlDataSourceCommunity"
27.            ConnectionString="<%$ ConnectionStrings:LEAD %>"
28.            ProviderName="System.Data.SqlClient"
29.            SelectCommand="SELECT c.community_id, c.name, r.region_id FROM all_communities c INNER JOIN all_communities_regions r ON c.community_id=r.community_id WHERE r.region_id=@region_id"
30.             runat="server">
31.            <SelectParameters>
32.                <asp:SessionParameter Name="region_id" SessionField="region_id" Type="string"/>
33.            </SelectParameters>
34.         </asp:SqlDataSource>
35.         
36.         <asp:SqlDataSource ID="SqlDataSourceHomes"
37.            ConnectionString="<%$ ConnectionStrings:LEAD %>"
38.            ProviderName="System.Data.SqlClient"
39.            SelectCommand="SELECT TOP 5 home_id, beds, bath, community_id FROM homes WHERE community_id = @community_id" runat="server">
40.            <SelectParameters>
41.                <asp:SessionParameter Name="community_id" SessionField="community_id" Type="string" />
42.            </SelectParameters>
43.        </asp:SqlDataSource>

Any thoughts?
-Jeff

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 31 Jul 2014, 05:28 AM
Hi Jeff,

Please set your DataKeyName as community_id for the first detailtable instead of region_id, as you are setting the SessionParameter as community_id for your second detailtable.

ASPX:
<telerik:GridTableView runat="server" DataKeyNames="community_id" DataSourceID="SqlDataSourceCommunity". . >

Thanks,
Princy
0
Jeff
Top achievements
Rank 1
answered on 31 Jul 2014, 08:35 PM
I had a feeling it would be something simple that I missed, thanks!
Tags
Grid
Asked by
Jeff
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Jeff
Top achievements
Rank 1
Share this question
or