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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Validating cell input best practise

Thread ID:

Created:

Updated:

Platform:

Replies:

49232 Sep 13,2006 09:58 PM UTC Sep 14,2006 05:57 AM UTC WinForms 1
loading
Tags: Grouping
jamesb
Asked On September 13, 2006 09:58 PM UTC

Between these three events, where would be the best consistent place to do input validation and perform do manual manipulation to the underlying datasource?

1. CurrentRecordContextChange
2. TableControlCurrentCellValidating
3. TableControlCurrentCellEditingComplete

Here are some requirements.
I would like access to the column and row index of the cell, the old and new value of the cell, and the underlying datarowview or record.

Users will be using the up/down/left/right arrow keys to navigate and changin values quickly, i.e., the values in the cell are by selected by default.

Administrator [Syncfusion]
Replied On September 14, 2006 05:57 AM UTC

Hi James,

The recommended solution is to handle TableControlCurrentCellValidating event for validating the cell data in a grid. So, Please try these code and see if it helps.

GridCurrentCell currentCell = e.TableControl.CurrentCell;
GridTableCellStyleInfo style = cc.Renderer.CurrentStyle as GridTableCellStyleInfo;

To get the RowIndex, use below code snippet.
int RowIndex = currentCell.RowIndex;

To get the ColIndex, use below code snippet.
int ColIndex = currentCell.ColIndex;

To get the OldValue, use below code snippet.
object OldValue = style.CellValue;

To get the NewValue, use below code snippet.
object NewValue = cc.Renderer.ControlValue;

To get the CurrentRecord, use below code snippet.
Record rec = e.TableControl.Table.CurrentRecord;

To get the CurrentDataRowView from CurrentRecord , use below code snippet.
Record rec = e.TableControl.Table.CurrentRecord;
DataRowView drv = rec.GetData() as DataRowView;

Please refer to the below KB article for more details on Validation of a cell.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=340

Let me know if you need any further assistance.

Best Regards,
Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;