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

[Solved] Self-referencing hierarchy grid with server side binding

1 Answer 80 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mattias
Top achievements
Rank 1
Mattias asked on 12 Jan 2010, 12:39 PM
Hi,
Is it possible to have a self-referencing hierarchy grid and bind the nested rows server side?

<telerik:RadGrid ID="radGridUnits" runat="server" AllowPaging="false" Width="100%" 
            AllowSorting="false" AutoGenerateColumns="false" GridLines="Both" CssClass="selfHierarchyTable"  
            oninsertcommand="radGridUnits_InsertCommand"  
            onupdatecommand="radGridUnits_UpdateCommand"  
            ondeletecommand="radGridUnits_DeleteCommand" 
            onitemdatabound="radGridUnits_ItemDataBound"  
            onneeddatasource="radGridUnits_NeedDataSource" 
            OnItemCreated="radGridUnits_ItemCreated" 
            OnColumnCreated="radGridUnits_ColumnCreated" 
            Skin="Default" onitemcommand="radGridUnits_ItemCommand"
             
            <mastertableview commanditemdisplay="Top" datakeynames="ID, ParentID"  
                HierarchyLoadMode="ServerOnDemand"   
                editmode="EditForms" name="Master" Width="100%"  
                nomasterrecordstext="<%$ Resources:resources,Msg_NoUnits %>"  
                tablelayout="Fixed"
                <SelfHierarchySettings ParentKeyName="ParentID" KeyName="ID" /> 
                <commanditemsettings addnewrecordtext="<%$ Resources:resources,Grid_AddUnit %>" refreshtext="<%$ Resources:resources,Grid_Refresh %>" /> 
                <Columns> 
                    <telerik:GridTemplateColumn UniqueName="Name2" HeaderText="<%$ Resources:resources,Label_Name %>"
                        <ItemTemplate> 
                            <asp:Button ID="MyExpandCollapseButton" runat="server" CommandName="ExpandCollapse" OnClick="button_Click"></asp:Button> 
                            <asp:Label ID="labelName" runat="server" Text='<%# Eval("Name") %>'></asp:Label> 
                        </ItemTemplate> 
                    </telerik:GridTemplateColumn> 

I was guessing that I should use ItemCommand event and check for ExpandCollapse argument but I cant figure out how to add the table structure to the grid then.
Maybe it's not exactly an self referencing grid I'm after, the important thing is to bind every level server side because it's a lot of levels and total number of rows.
 
Is this possible?

Regards,
Mattias

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 13 Jan 2010, 03:08 PM
Hi Mattias,

RadGrid's self-referencing hierarchical structure does not support the ServerOnDemand HierarchyLoad mode. As for binding the grid on the server - it is always bound on the server both with the Client and the Server load mode. In addition, you are correct in observing that it is not possible to create the structure of the nested tables in code behind.

I hope this helps.

Regards,
Tsvetoslav
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Mattias
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or