Hi Anna,
You can edit the nested table cell value using the following code snippet.
// To Edit a cell in the nested table
GridTableControl mytable = this.gridGroupingControl1.GetTableControl("Salary");
foreach( Record r in mytable.Table.Records)
{
if((int)r.GetValue("Numeric") > 50)
r.SetValue("Des","New");
}
If you want to validate the changed value as your user leaves the cell, then you can use the TableControlCurrentCellValidating event. In it, you can use e.TableControl.CurrentCell.Renderer.ControlText to get the proposed text, and you can set e.Cancel to prevent your user from leaving the cell.
// TableControlCurrentCellValidating Event
private void gridGroupingControl1_TableControlCurrentCellValidating(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCancelEventArgs e)
{
Element el = this.gridGroupingControl1.Table.CurrentElement;
if(el != null && el.Kind == DisplayElementKind.NestedTable)
{
GridTableControl mytable = this.gridGroupingControl1.GetTableControl("Salary");
GridCurrentCell cc = mytable.CurrentCell;
if(cc != null && cc.Renderer.ControlText != null)
{
GridTableCellStyleInfo sinfo = (GridTableCellStyleInfo)mytable.CurrentCell.Renderer.StyleInfo;
GridTableCellStyleInfoIdentity style = sinfo.TableCellIdentity;
if( style.Column.Name == "Salary" && !(Convert.ToInt32(cc.Renderer.ControlText) >= 50))
e.Inner.Cancel = true;
}
}
}
Sample :
AccessingNestedTables
Best regards,
Madhan