To prevent the cell from leaving edit mode, you will need to handle ValidationError event of each DataCell in the grid and set the CancelEdit event argument to false.
Demonstration
The following example demonstrates how to prevent a cell from leaving edit mode.
VB.NET |
Copy Code |
gridControl1.BeginInit()
gridControl1.DataSource = dataSet11 gridControl1.DataMember = "Orders"
Dim cell As DataCell
For Each cell in gridControl1.DataRowTemplate.Cells AddHandler cell.ValidationError, AddressOf Me.cell_ValidationError Next cell
gridControl1.EndInit()
Private Sub cell_ValidationError( ByVal sender As Object, ByVal e As CellValidationErrorEventArgs ) ' code to prevent the cell from exiting edit mode e.CancelEdit = False End Sub
|
C# |
Copy Code |
gridControl1.BeginInit();
gridControl1.DataSource = dataSet11; gridControl1.DataMember = "Orders";
foreach( DataCell cell in gridControl1.DataRowTemplate.Cells ) { cell.ValidationError += new CellValidationErrorEventHandler( this.cell_ValidationError ); }
gridControl1.EndInit();
private void cell_ValidationError( object sender, CellValidationErrorEventArgs e ) { // code to prevent the cell from exiting edit mode e.CancelEdit = false; }
|