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

Hierachical RadGrid : How to populate the RadGrid using 2 different queries.

3 Answers 78 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 24 Jan 2013, 06:26 AM
Hi,

Is there an inbuilt function or a way to use 2 different queries to grab the data that populates the Hierachical RadGrid 
- that is one to get the parent rows and the other to get only the child data corresponding to the parent row that is clicked (Currently a single query gets all the data) - I am trying to implement this because the dataset being passed is huge and this increases the loading time.This is kinda urgent,  I just wanted to know if this is possible or not. 

Thanks for any help.

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 24 Jan 2013, 07:45 AM
Hi,

You can populate the detail table in DetailTableBind event as explained in the following demo.
Grid / Programmatic Binding

Thanks,
Princy
0
Paul
Top achievements
Rank 1
answered on 25 Jan 2013, 10:37 AM
Hi Princy,

Thank you for the reply,

I tried using OnDetailtablesdatabind, but I am not able to get the id that is selected in parent grid. I have 2 GridTableView within a DetailTables. will that be the reason why I am not able to access the DataKeyNames that is being passed?
0
Princy
Top achievements
Rank 2
answered on 25 Jan 2013, 10:52 AM
Hi,

You can access the datakeynames in DetailTableBind event as shown below.
aspx:
<MasterTableView  DataKeyNames="CustomerID"....>
C#:
protected void RadGrid2_DetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e)
{
        if (e.DetailTableView.Name == "DetailTable1")
        {
            e.DetailTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
            GridTableView detailtabl1 = (GridTableView)e.DetailTableView;
            GridDataItem parentItem = (GridDataItem)detailtabl1.ParentItem;
           string customerId = parentItem.GetDataKeyValue("CustomerID").ToString();
 
        }
}

Thanks,
Princy
Tags
Grid
Asked by
Paul
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Paul
Top achievements
Rank 1
Share this question
or