hi
i have 3 table: 1- Master table 2- Detail table(0) 3- Detail table(1)
when i want update detailTable(0) i can:
i have 3 table: 1- Master table 2- Detail table(0) 3- Detail table(1)
when i want update detailTable(0) i can:
int ParentId = RadGrid1.MasterTableView.DataKeyValues[
int.Parse(e.Item.OwnerTableView.ParentItem.ItemIndexHierarchical)]["Id"].ToString();
but when i want update DetailTable(1) i can not use this code :
int ParentId = RadGrid1.MasterTableView.DetailTables[0].DataKeyValues[int.Parse(e.Item.OwnerTableView.ParentItem.ItemIndexHierarchical)][
"Id"].ToString();
// erro ocured and i can not use :((
maybe my method completly is uncurrect.
6 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 18 Aug 2009, 08:23 AM
Hello,
Check out the following code that I tried to retrieve the DataKeyValues for the third level's parnet item in a hierarchial grid:
c#:
Hope this helps... :)
Princy.
Check out the following code that I tried to retrieve the DataKeyValues for the third level's parnet item in a hierarchial grid:
c#:
string ParentId = item.OwnerTableView.ParentItem.GetDataKeyValue("Id").ToString(); |
Hope this helps... :)
Princy.
0
Pouya ir
Top achievements
Rank 1
answered on 18 Aug 2009, 05:34 PM
tnxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ! ! ! ! !
0
illumination
Top achievements
Rank 2
answered on 16 Jun 2011, 07:10 PM
How do I grab this parent ID and put in a textbox in editmode of the detail table?
0
Princy
Top achievements
Rank 2
answered on 17 Jun 2011, 08:32 AM
Hello Illumination,
Try the following code snippet in ItemDataBound event to get the parent ID in edit mode. Hope this helps.
C#:
Thanks,
Princy.
Try the following code snippet in ItemDataBound event to get the parent ID in edit mode. Hope this helps.
C#:
protected
void
RadGrid2_ItemDataBound(
object
sender, GridItemEventArgs e)
{
if
(e.Item
is
GridEditableItem && e.Item.IsInEditMode && e.Item.OwnerTableView.Name ==
"DetailTable1"
)
{
GridEditableItem item = (GridEditableItem)e.Item;
string
customerId1 = item.OwnerTableView.ParentItem.GetDataKeyValue(
"ID"
).ToString();
TextBox txtbox = (TextBox)item[
"temp"
].FindControl(
"txt"
);
txtbox.Text = customerId1;
}
}
Thanks,
Princy.
0
illumination
Top achievements
Rank 2
answered on 17 Jun 2011, 02:02 PM
Perfect!!! Thank you so much, Princy.
0
Jeffrey Sanford
Top achievements
Rank 2
answered on 14 Mar 2014, 06:23 PM
This actually just helped me. Thanks!