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

[Solved] telerik radgrid hierarchical grid

2 Answers 100 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Arvind Singh
Top achievements
Rank 2
Arvind Singh asked on 27 Aug 2009, 02:27 PM
Hi,

I have couple of queries. Please let me know how we can implement them?

1. Can we have different detail table view for each row of a master table view?

MasterTableView

Item1 (Row1)  ---------------------------------------------------------------------------------------
        DetailTableView 1
Item2 (Row 2) ---------------------------------------------------------------------------------------
        DetailTableView2

2. Can we drag and drop the items of DetailTableView1 to DetailTableView2 and vice-versa?

Please let me know if this possible.

Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Aug 2009, 05:00 AM
Hi Arvind,

One suggestion will be to populate the DetailTable with different Data in the DetailTableDataBind event depending on the Parent row key value. Here is a sample code:

CS:
 
protected void RadGrid1_DetailTableDataBind(object source, Telerik.Web.UI.GridDetailTableDataBindEventArgs e) 
    { 
        GridDataItem dataItem = (GridDataItem)e.DetailTableView.ParentItem; 
        string parentKey = dataItem.GetDataKeyValue("Category").ToString(); 
        if (parentKey == "Category1"
        { 
            e.DetailTableView.DataSource = GetDataTable("SELECT * FROM Category1 "); 
        } 
        else if (parentKey == "Category2"
        { 
            e.DetailTableView.DataSource = GetDataTable("SELECT * FROM Category2 "); 
        } 
        
    } 

You can also go through the following code library submission which demonstrates how to implement drag and drop between Detail table rows.
Drag and drop to reorder rows in grid

Thanks
Shinu

0
Arvind Singh
Top achievements
Rank 2
answered on 28 Aug 2009, 05:45 AM
Hi Shinu,

The below code snippet given by you demonstrates that, at a time, we can populate detail table view with only one data source. Our requirement is litttle different than this.

1. In our case, the whole RadGrid will be built programatically at runtime.
2. The databinding scenario is like this

MasterTableView
DataRow1 
     DataRow1 should have one detail table binded with datasource1.
DataRow2
     DataRow2 should have one more detail table binded with dataSource2

So, my point is can we bind data in this way, Please suggest some other ways also to fulfill this requirement if possible.

When DataRow1 is expanded, he sees the data from dataSource1 and when DataRow2 is expanded, he sees the data from DataSource2.

Thanks in advance
    
Tags
Grid
Asked by
Arvind Singh
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Arvind Singh
Top achievements
Rank 2
Share this question
or