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

[Solved] Hierarchical Grid

1 Answer 86 Views
Grid
This is a migrated thread and some comments may be shown as answers.
DK
Top achievements
Rank 2
DK asked on 23 Jul 2009, 10:54 AM
How to get grid data values from detail table when expand=false.
mease i have not expanded the detail table view and i want to extract those values from the grid.

i m not geting the values in this scenerio.
please help me to find the values from the detail table view

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 Jul 2009, 11:53 AM
Hello,

You can try out the following code to access the detail table data in a hierarchical grid as shown below provided that you set the HierarchyLoadMode for the MasterTableView to Client:
aspx:
<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="Sqldatasource1" OnPreRender="RadGrid1_PreRender">                 
      <MasterTableView Name="Master" HierarchyLoadMode="Client" DataSourceID="Sqldatasource1"
          ....         

c#:
protected void RadGrid1_PreRender(object sender, EventArgs e) 
    {         
        foreach (GridDataItem dataItem in RadGrid1.MasterTableView.Items) 
        { 
            if (dataItem.OwnerTableView.Name == "Master"
            { 
                string strtxt1 = dataItem["ProductName"].Text;                 
                    GridTableView nestedView = (GridTableView)dataItem.ChildItem.NestedTableViews[0]; 
                    foreach (GridDataItem item in nestedView.Items) 
                    { 
                        string strtxt2 = item["OrderDate"].Text; 
                    }                                
            } 
        } 
   } 

Thanks
Shinu.
Tags
Grid
Asked by
DK
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Share this question
or