We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Reg: GroupingGrid(Nested Table)

Hi, I have a grouping grid with one nested table on my application. Nested table contains date column, double column and string column. Requirements: 1) I want to edit the nested table column on the grid. 2) I want to validate the date and double column when the user modifies the value. Kindly give me a sample app which meets my requirements. Regards, Anna

1 Reply

AD Administrator Syncfusion Team July 4, 2006 04:23 PM UTC

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

Loader.
Live Chat Icon For mobile
Up arrow icon