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

how to get the parent table column

2 Answers 521 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Himanshu
Top achievements
Rank 1
Himanshu asked on 26 Mar 2014, 11:05 AM
how to access the parent table column value in child table when we using the hierarchy of telerik Radgrid.

cs source-

protected void cmpreportgrid_OnItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {

         if (e.Item is GridDataItem)
        {
            if (e.Item.OwnerTableView.Name == "CompanyListDetails")
            {
                if (e.Item is GridDataItem)
                {
                    GridDataItem item = e.Item as GridDataItem;
                    Viewing view = item.DataItem as Viewing;
                    if (!view.isgroupcontact)
                    {
                       
                        item["ExpandColumn"].Text = "";
                    }
                    
                }  
            }
       else if (e.Item.OwnerTableView.Name == "GroupContact")
            {
                e.Item.OwnerTableView.ParentItem.Expanded=false;//how to get the parent table column here to set the condition for expandcolumn.
            }       
        }
    }

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 28 Mar 2014, 11:30 AM
Hi Himanshu,

You can have a look at this documentation which discusses on Accessing Table Views in a Hierarchical Grid.

Thanks,
Shinu
0
Konstantin Dikov
Telerik team
answered on 31 Mar 2014, 06:25 AM
Hello Himanshu,

The help article that Shinu provided should help accomplish your requirement. The main idea is first access the parent data item, cast it to GridDataItem and retrieve the value from the column in interest:
GridDataItem parentItem = childItem.OwnerTableView.ParentItem;

If any additional assistance is needed, please feel free to get back to us.


Regards,
Konstantin Dikov
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
Grid
Asked by
Himanshu
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Konstantin Dikov
Telerik team
Share this question
or