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

RadTree as column in RadGrid

4 Answers 70 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sagar Baheti
Top achievements
Rank 1
Sagar Baheti asked on 11 Aug 2008, 12:04 PM
Hi,
Actually i have one requirement in which i want to add RadTree as Column in RadGrid. So Can you tell me is it possible to add RadTree as column in RadGrid?
If yes please suggest me some example so that i can start for it
Please help me.....


Thanks and regards,
Sagar

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 11 Aug 2008, 12:12 PM
Hi Sagar,

You can place any control in GridTemplateColumn ItemTemplate including RadTreeView.

Best wishes,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Princy
Top achievements
Rank 2
answered on 11 Aug 2008, 12:21 PM
Hi Sagar,

You can also have a look at the following demo link to get more details about the column types in RadGrid.
Column types

Thanks
Princy.
0
Sagar Baheti
Top achievements
Rank 1
answered on 14 Aug 2008, 07:09 AM
Hi Princy,
Actually i have one column in Grid as RadTree , now how can i bind data to tree which in the column in the RadGrid. I tried to find that conrol in NeedDataScource method but i couldn't. My column structure is as given in the following code

 <Columns>
<telerik:GridTemplateColumn HeaderText="Bundle Name" HeaderButtonType="TextButton" UniqueName="bundle_id" >
                            <ItemTemplate>
                                <div id="div1">
                                   <telerik:RadTreeView ID="radOrgTreeView" runat="server"  OnClientNodeClicking="nodeClicking"  >
                                       <CollapseAnimation Duration="100" Type="OutQuint" />
                                       <ExpandAnimation Duration="100" />
                                    </telerik:RadTreeView>
                                </div>
                             </ItemTemplate>                         
                            
 </telerik:GridTemplateColumn>
                     
                        <telerik:GridBoundColumn SortExpression="ShortName" HeaderText="Short Name" HeaderButtonType="TextButton" UniqueName="CategoryId" ></telerik:GridBoundColumn>

                        <telerik:GridBoundColumn SortExpression="Edit" HeaderText="Edit"  HeaderButtonType="TextButton" UniqueName="Description"></telerik:GridBoundColumn>
                        <telerik:GridBoundColumn SortExpression="Delete" HeaderText="Delete"  HeaderButtonType="TextButton" UniqueName="Description"></telerik:GridBoundColumn>
                      
 </Columns>  


please help me for that...


Thanks and regard,
Sagar
0
Princy
Top achievements
Rank 2
answered on 14 Aug 2008, 08:14 AM
Hello Sagar,

You can try accessing the TreeView in the TemplateColumn, in the ItemDataBound event and then try binding it to the DataSource as shown below.
cs:
protected void RadGrid4_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridDataItem) 
        { 
            GridDataItem data = (GridDataItem)e.Item; 
            RadTreeView treeview = (RadTreeView)data["bundle_id"].FindControl("radOrgTreeView"); 
            treeview.DataTextField = "ID"
            treeview.DataSourceID = "SqlDataSource2"
        } 
    } 

Thanks
Princy.
Tags
Grid
Asked by
Sagar Baheti
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Princy
Top achievements
Rank 2
Sagar Baheti
Top achievements
Rank 1
Share this question
or