Parent of child record

Hello,

I am using a grid grouping control
The grid consists of two table, one table is the child of the other.

when the currentcellacceptedchanges event is called from a field in the child table i need to check the values in the parent row for that table.

Is there any way to do that in the currentcellacceptedchanges event?

+Row1|Column2|Column3
+Row2|Column2|Column3
-Row3|Column2|Column3
subRow1|Column2
subRow2|Column2

For example Rows 1 2 and 3 are in the parent table.
Row 3 is expanded
subrow1 and 2 are in the child table of row 3
If someone changes a value in column 2 of subrow 2, I want to be able to find the values in row3 when the the currentcellacceptedchanges event fires for subrow2 column 2

Is this possible?

Thanks


2 Replies

AD Administrator Syncfusion Team July 25, 2008 10:37 PM UTC

Try code like this.

void gridGroupingControl1_TableControlCurrentCellAcceptedChanges(object sender, GridTableControlCancelEventArgs e)
{
GridCurrentCell cc = e.TableControl.GetNestedCurrentCell();
GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(cc.RowIndex, cc.ColIndex);
Record childRecord = style.TableCellIdentity.DisplayElement.GetRecord();
if (childRecord != null)
{
GridRecord parentRecord = childRecord.ParentChildTable.ParentDisplayElement.GetRecord() as GridRecord;
if (parentRecord != null)
{
Console.WriteLine(parentRecord); //use parentRecord.GetValue(columnName) to get a particular value
}
}
}





AD Administrator Syncfusion Team July 28, 2008 11:13 PM UTC

Thanks for the reply.

The showed me exactly what I needed to do.


Loader.
Up arrow icon