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

Help: acces parent row data

1 Answer 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gábor
Top achievements
Rank 1
Gábor asked on 20 Sep 2012, 05:23 PM
Here is the problem:
I have a radgrid with a child grid. For example: Main grid for companies, child grid for employees of the chosen company. I want to add new employees to a company using the "add new record" button in the child grid's head. I made a nested ascx page with some textboxes and a "save" button. I also need the company ID to save the employees data. How can I access the company ID from the nested ascx view?

Sorry for the bad English,

Thanks,

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 21 Sep 2012, 05:30 AM
Hi,

One suggestion is that you can set the CompanyId as and access it as shown below.
C#:
protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
{
  if (e.Item is GridEditFormInsertItem && e.Item.OwnerTableView.Name == "DetailTable1")
  {
    GridEditFormInsertItem item = (GridEditFormInsertItem)e.Item;
    string Id = item.OwnerTableView.ParentItem.GetDataKeyValue("CompanyID").ToString();
   }
}

Thanks,
Shinu.
Tags
Grid
Asked by
Gábor
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or