How to create Self Hierarchy In Grid

2 posts, 0 answers
  1. Majid
    Majid avatar
    9 posts
    Member since:
    Dec 2008

    Posted 15 Jul 2013 Link to this post

    Hi,

    I want to show parent child hierarchy or self hierarchy but I don't know Levels of Hierarchy.  Next Hierarchy Table should be shown on based of some decision from code. I have seen one example http://www.telerik.com/help/aspnet-ajax/grid-self-referencing-hierarchy.html But It didn't allow any CRUD operations.

    I want to do this by Coding and How can I add more GridTableView in Existing GridTableView? Below is Grid Code

    <telerik:RadGrid ID="BicCodeGrid" runat="server" AutoGenerateColumns="false" OnNeedDataSource="BicCodeGrid_NeedDataSource"
                        Skin="Silk" OnItemCommand="BicCodeGrid_ItemCommand" OnDetailTableDataBind="BicCodeGrid_DetailTableDataBind"
                        OnItemDataBound="BicCodeGrid_ItemDataBound" >
                        <MasterTableView Width="100%" DataKeyNames="BICCodeID" ClientDataKeyNames="BICCodeID"
                            HorizontalAlign="NotSet" AutoGenerateColumns="False">
                            <Columns>
                                <telerik:GridBoundColumn HeaderText="Kode" DataField="BICCode" UniqueName="BICCode"
                                    ReadOnly="true" ItemStyle-Width="50px">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="Område" DataField="DanishDescription" UniqueName="DanishDescription"
                                    ReadOnly="true" ItemStyle-Width="400px">
                                </telerik:GridBoundColumn>
                                <telerik:GridButtonColumn ButtonType="PushButton" Text=" + " CommandName="AddBicCode">
                                </telerik:GridButtonColumn>
                            </Columns>
                            <DetailTables>
                                <telerik:GridTableView DataKeyNames="BICCodeID" Name="DetailsTable" Width="100%" on>
                                    <ParentTableRelation>
                                        <telerik:GridRelationFields MasterKeyField="BICCodeID" DetailKeyField="ParentID" />
                                    </ParentTableRelation>
                                    <Columns>
                                        <telerik:GridBoundColumn HeaderText="Kode" DataField="BICCode" UniqueName="BICCode"
                                            ReadOnly="true" ItemStyle-Width="50px">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridBoundColumn HeaderText="Område" DataField="DanishDescription" UniqueName="DanishDescription"
                                            ReadOnly="true" ItemStyle-Width="300px">
                                        </telerik:GridBoundColumn>
                                        <telerik:GridButtonColumn ButtonType="PushButton" Text=" + " CommandName="AddBicCode">
                                        </telerik:GridButtonColumn>
                                    </Columns>
                                </telerik:GridTableView>
                            </DetailTables>
                        </MasterTableView>
                        <ClientSettings>
                            <ClientEvents OnCommand="RaiseCommand" />
                        </ClientSettings>
                    </telerik:RadGrid>

     

     

     

  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 17 Jul 2013 Link to this post

    Hi Majid,

    Instead of using RadGrid with self referencing hierarchy for your scenario, better option would be to use the RadTreeList control which fully covers your requirements and supports CRUD operations as per your needs. See the online demo below for more information on this matter:
    http://demos.telerik.com/aspnet-ajax/treelist/examples/overview/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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top