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

How can I access the current record in the ggc and/or in the underlying datatable from TableControlCurrentCellValidating?

Firstly, is this the right event to use when validating cell input and wanting to cancel if validation fails?

How can I access the GridRecord?


How can I access the DataRow of the underlying datatable?

5 Replies

JB James Blibo December 13, 2006 10:40 PM UTC

found it... never mind


JB James Blibo December 13, 2006 10:51 PM UTC

I can not get the DataRowView from the Record in the TableControlCurrentCellValidating.

Record rec = e.TableControl.Table.CurrentRecord;
DataRowView drv = rec.GetData() as DataRowView;

Please help! DataRowView is null!


AD Administrator Syncfusion Team December 14, 2006 06:54 AM UTC

Hi James,

Please refer to the following sample which demonstrates the retrieving of the DataRowView of the currently edited record using your code snippet. Please check whether the editing row is being Record display kind. Which version of the grid are using?

Sample: GGC_CurrentCellValidating.zip

Kindly try it and let us know if you need any further assistance.
Have a nice day.

Best regards,
Madhan


JB James Blibo December 15, 2006 10:44 PM UTC

This is the same code that I posted and said wasn't working. DataRowView is always null.

I have a flat datasource that is grouped by one column. The version of the grid is 4.4


AD Administrator Syncfusion Team December 18, 2006 10:15 AM UTC

Hi James,

Thank you for being patience.

We tried using your code snippet to reproduce the issue here. The reason for the DataRowView being null is because the resultant of the rec.GetData() method is DataRow. Please try using the following code snippet to retrieve the data.

>>>>>>>>>>>>
// TableControlCurrentCellValidating event
Record rec = e.TableControl.Table.CurrentRecord;
DataRow dr = rec.GetData() as DataRow;
Console.WriteLine(dr[0]);
>>>>>>>>>>>>

Kindly let us know if you need any further assistance.

Best regards,
Madhan

Loader.
Live Chat Icon For mobile
Up arrow icon