This sample demonstrates formatting data in a grid. The codes used in this sample illustrate number and date-time formatting. Code for validating data when leaving the cell is also included. Essential Grid uses the . NET Framework formatting support. This formatting is culture sensitive.
Features:
The Minimum and Maximum properties of the ValidateValue can be set to restrict the values only to positive numbers.
This can also be set in one line of code as it is shown below for the validation (1-100).
model.RowStyles[rowIndex].ValidateValue = new GridCellValidateValueInfo(true, 1, 100, "Please enter a number between 1 and 100!");
By setting the StrictValueType property to false, strings can be entered into the double CellValueType. By default, StrictValueType is true.
To change the CellValueType when strings are entered for specified cells, the Style.Tag must be set to a string. This can be checked before changing CellValueType. SaveCellFormattedText carries the GridCellTextEventArgs instance and is triggered when leaving the cell. When you make use of it, CellValueType is changed to a string
In SaveCellFormattedText, e.Text is assigned to CellValue. CellValueType is also changed.