//Event
Handlers
pivotGridControl1.TableControl.CurrentCellStartEditing
+= OnCurrentCellStartEditing;
pivotGridControl1.TableControl.CurrentCellEditingComplete
+= OnCurrentCellEditingComplete;
//
Maintain the cell value in the tempVariable
string tempVariable;
//
Event handler for the CurrentCellStartEditing event
private void OnCurrentCellStartEditing(object sender, CancelEventArgs e)
{
// Get the current cell
var
currentCell = pivotGridControl1.TableControl.CurrentCell;
// Get the cell value and store it in the
temp variable
tempVariable = pivotGridControl1.TableModel[currentCell.RowIndex,
currentCell.ColIndex].CellValue.ToString();
}
//
Event handler for the CurrentCellEditingComplete event
private void OnCurrentCellEditingComplete(object sender, EventArgs
e)
{
// Get the current cell
var
currentCell = pivotGridControl1.TableControl.CurrentCell;
// Customize the condition based on your
requirement
// Here validate that the user entered
number and restore the original value (using tempVariable) if not satisfy the
condition
if
(pivotGridControl1.TableModel[currentCell.RowIndex,
currentCell.ColIndex].CellValue.ToString() == "4")
// Restore the original value when the user
entered value is 4
pivotGridControl1.TableModel[currentCell.RowIndex,
currentCell.ColIndex].CellValue = tempVariable;
}
|