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

Hierarchy grid view on more than 2 levels not working

1 Answer 81 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Minh Kevin
Top achievements
Rank 1
Minh Kevin asked on 01 Oct 2013, 03:46 PM
Hi,

i'm currently trying to do a hierarchy grid view on more than 2 levels and it isn't working.

The grid is working fine if I use two levels but as soon as i add another one the expand on the grid show nothing after the second level

Here's the code of the grid : 

<telerik:RadGrid ID="rg_VL" runat="server"
        DataSourceID="SqlDataSourceCODPRO1"
        AllowSorting="True" AllowMultiRowSelection="False" AllowPaging="False" GridLines="None">
        <MasterTableView AutoGenerateColumns="false" DataSourceID="SqlDataSourceCODPRO1" DataKeyNames="CODPRO1">
            <DetailTables>
                        <telerik:GridTableView DataKeyNames="CODPRO2" DataSourceID="SqlDataSourceCODPRO2" runat="server">
                        <ParentTableRelation>
                            <telerik:GridRelationFields DetailKeyField="CODPRO1" MasterKeyField="CODPRO1" />
                        </ParentTableRelation>
                        <DetailTables>
                                                        <telerik:GridTableView DataKeyNames="CODPRO3" DataSourceID="SqlDataSourceCODPRO3" runat="server">
                                                        <ParentTableRelation>
                                                            <telerik:GridRelationFields DetailKeyField="CODPRO2" MasterKeyField="CODPRO2" />
                                                        </ParentTableRelation>
                                                        <DetailTables>
                                                                                        <telerik:GridTableView DataKeyNames="CODPRO4" DataSourceID="SqlDataSourceCODPRO4" runat="server">
                                                                                            <ParentTableRelation>
                                                                                                <telerik:GridRelationFields DetailKeyField="CODPRO3" MasterKeyField="CODPRO3" />
                                                                                            </ParentTableRelation>
                                                                                            <DetailTables>
                                                                                                                        <telerik:GridTableView DataKeyNames="CODPRO5" DataSourceID="SqlDataSourceCODPRO5" runat="server">
                                                                                                                            <ParentTableRelation>
                                                                                                                                <telerik:GridRelationFields DetailKeyField="CODPRO4" MasterKeyField="CODPRO4" />
                                                                                                                            </ParentTableRelation>
                                                                                                                            <Columns>
                                                                                                                                <telerik:GridBoundColumn SortExpression="CODPRO5" HeaderText="CODPRO5" HeaderButtonType="TextButton"
                                                                                                                                    DataField="CODPRO5" UniqueName="CODPRO5">
                                                                                                                                </telerik:GridBoundColumn>
                                                                                                                            </Columns>
                                                                                                                        </telerik:GridTableView>
                                                                                            </DetailTables>
                                                                                            <Columns>
                                                                                                <telerik:GridBoundColumn SortExpression="CODPRO4" HeaderText="CODPRO4" HeaderButtonType="TextButton"
                                                                                                    DataField="CODPRO4" UniqueName="CODPRO4">
                                                                                                </telerik:GridBoundColumn>
                                                                                            </Columns>
                                                                                        </telerik:GridTableView>
                                                        </DetailTables>
                                                            <Columns>
                                                                <telerik:GridBoundColumn SortExpression="CODPRO3" HeaderText="CODPRO3" HeaderButtonType="TextButton"
                                                                    DataField="CODPRO3" UniqueName="CODPRO3">
                                                                </telerik:GridBoundColumn>
                                                            </Columns>
                                                            <SortExpressions>
                                                                <telerik:GridSortExpression FieldName="CODPRO3"></telerik:GridSortExpression>
                                                            </SortExpressions>
                                                        </telerik:GridTableView>
                        </DetailTables>
                            <Columns>
                                <%--<telerik:GridBoundColumn SortExpression="CODPRO2" HeaderText="CODPRO2" HeaderButtonType="TextButton"
                                    DataField="CODPRO2" UniqueName="CODPRO2">
                                </telerik:GridBoundColumn>--%>
                            </Columns>
                            <SortExpressions>
                                <telerik:GridSortExpression FieldName="CODPRO2"></telerik:GridSortExpression>
                            </SortExpressions>
                        </telerik:GridTableView>
            </DetailTables>
            <Columns>
                <telerik:GridBoundColumn SortExpression="CODPRO1" HeaderText="CODPRO1" HeaderButtonType="TextButton"
                    DataField="CODPRO1" UniqueName="CODPRO1">
                </telerik:GridBoundColumn>
            </Columns>
            <SortExpressions>
                <telerik:GridSortExpression FieldName="CODPRO1"></telerik:GridSortExpression>
            </SortExpressions>
        </MasterTableView>
    </telerik:RadGrid>


And the code of my datasources :

<asp:SqlDataSource ID="SqlDataSourceCODPRO1" ConnectionString="<%$ ConnectionStrings:bddBigJimWeb %>"
    ProviderName="System.Data.OracleClient" SelectCommand="SELECT DISTINCT CODPRO1 FROM VENTES_LACH_REG ORDER BY CODPRO1"
    runat="server">
</asp:SqlDataSource>
     
<asp:SqlDataSource ID="SqlDataSourceCODPRO2" ConnectionString="<%$ ConnectionStrings:bddBigJimWeb %>"
    ProviderName="System.Data.OracleClient" SelectCommand="SELECT DISTINCT CODPRO2 FROM VENTES_LACH_REG Where CODPRO1 = :CODPRO1"
    runat="server">
    <SelectParameters>
        <asp:SessionParameter Name="CODPRO1" SessionField="CODPRO1" Type="string">
        </asp:SessionParameter>
    </SelectParameters>
</asp:SqlDataSource>
 
<asp:SqlDataSource ID="SqlDataSourceCODPRO3" ConnectionString="<%$ ConnectionStrings:bddBigJimWeb %>"
    ProviderName="System.Data.OracleClient" SelectCommand="SELECT DISTINCT CODPRO3 FROM VENTES_LACH_REG CODPRO1 = :CODPRO1 AND CODPRO2 = :CODPRO2"
    runat="server">
    <SelectParameters>
        <asp:SessionParameter Name="CODPRO1" SessionField="CODPRO1" Type="string">
        </asp:SessionParameter>
        <asp:SessionParameter Name="CODPRO2" SessionField="CODPRO2" Type="string">
        </asp:SessionParameter>
    </SelectParameters>
</asp:SqlDataSource>
 
<asp:SqlDataSource ID="SqlDataSourceCODPRO4" ConnectionString="<%$ ConnectionStrings:bddBigJimWeb %>"
    ProviderName="System.Data.OracleClient" SelectCommand="SELECT DISTINCT CODPRO4 FROM VENTES_LACH_REG WHERE CODPRO1 = :CODPRO1 AND CODPRO2 = :CODPRO2 AND CODPRO3 = :CODPRO3"
    runat="server">
    <SelectParameters>
        <asp:SessionParameter Name="CODPRO1" SessionField="CODPRO1" Type="string">
        </asp:SessionParameter>
        <asp:SessionParameter Name="CODPRO2" SessionField="CODPRO2" Type="string">
        </asp:SessionParameter>
        <asp:SessionParameter Name="CODPRO3" SessionField="CODPRO3" Type="string">
        </asp:SessionParameter>
    </SelectParameters>
</asp:SqlDataSource>
 
<asp:SqlDataSource ID="SqlDataSourceCODPRO5" ConnectionString="<%$ ConnectionStrings:bddBigJimWeb %>"
    ProviderName="System.Data.OracleClient" SelectCommand="SELECT DISTINCT CODPRO5 FROM VENTES_LACH_REG WHERE CODPRO1 = :CODPRO1 AND CODPRO2 = :CODPRO2 AND CODPRO3 = :CODPRO3 AND CODPRO4 = :CODPRO4"
    runat="server">
    <SelectParameters>
        <asp:SessionParameter Name="CODPRO1" SessionField="CODPRO1" Type="string">
        </asp:SessionParameter>
        <asp:SessionParameter Name="CODPRO2" SessionField="CODPRO2" Type="string">
        </asp:SessionParameter>
        <asp:SessionParameter Name="CODPRO3" SessionField="CODPRO3" Type="string">
        </asp:SessionParameter>
        <asp:SessionParameter Name="CODPRO4" SessionField="CODPRO4" Type="string">
        </asp:SessionParameter>
    </SelectParameters>
</asp:SqlDataSource>


Do you know why I have no errors shown on my web page but no hirarchical level after the second level ?

Regards

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 07 Oct 2013, 08:28 AM
Hello Minh,

I would suggest you to review the online demo below which elaborates on settings more than one level hierarchy:
http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/threelevel/defaultcs.aspx

Regards,
Maria Ilieva
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
GridView
Asked by
Minh Kevin
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or