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
close icon

GGC Mapping name and value of current cell

I have a GGC using a TableControlCurrentCellEditingComplete event to trigger validation. I would like to validate data entered into some of the cells and would like to use the mapping name to determine if the cell needs validation. I would like to something like: int n = e.TableControl.TableDescriptor.ColIndexToField(e.Inner.ColIndex); string colname = e.TableControl.TableDescriptor.Columns[n].MappingName; if (colname.Equals(...)) get cellvalue ... However, the e.Inner (GridTableControlEventArgs e) does not contain the ColIndex. Should I use a different event? Also how can I get the edited value from the cell. Thanks

2 Replies

AD Administrator Syncfusion Team October 19, 2005 05:40 PM UTC

You can use code like: GridCurrentCell cc = e.TableControl.CurrentCell; GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(cc.RowIndex, cc.ColIndex); Console.WriteLine(style.TableCellIdentity.Column.MappingName); //column name Console.WriteLine(cc.Renderer.ControlText); //current value to get the information you wanted. Not sure what you mean by validate some cells, but TableControlEditingComplete is not a cancelable event. SO, backing out changes may be a problem trying to do cell validation here. Instead, you might trt TableCOntrolCurrentCellValidating to see if that works better for you. You can set e.Inner.Cancel = true to not let the user leave the cell.


JS John Slater October 19, 2005 06:01 PM UTC

Thanks for the advice, it''s working perfect. >You can use code like: > >GridCurrentCell cc = e.TableControl.CurrentCell; >GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(cc.RowIndex, cc.ColIndex); >Console.WriteLine(style.TableCellIdentity.Column.MappingName); //column name >Console.WriteLine(cc.Renderer.ControlText); //current value > > >to get the information you wanted. Not sure what you mean by validate some cells, but TableControlEditingComplete is not a cancelable event. SO, backing out changes may be a problem trying to do cell validation here. Instead, you might trt TableCOntrolCurrentCellValidating to see if that works better for you. You can set e.Inner.Cancel = true to not let the user leave the cell.

Loader.
Live Chat Icon For mobile
Up arrow icon