Validate Data for GridView Component
The Kettic DataGridView allows users of the control easily validate data grid cells when data is committed to the data source. To validate data to grid cells and rows, we need to use the ValidateCell event, which will be raised by the Kettic DataGridView when there are any changes to the current cell or when the grid cell loses input focus like. Before we validate data to grid cell, we need to cancel the ValidateCell event to prevent the users from exiting the cell until entering a valid editor value or cancelling the edit process. Meanwhile, we can use the ValidateRow event in the same way to prevent the user from exiting the current row.
Events for Validating Grid Cell in C#
Kettic DataGridView provides a few events for data validating to grid cells and rows. The following are the complete events for the data validation.
C# code for Data Cell Validation
We are going through the following C# code to analyze the process of validating data in grid cell. The C# code snippet will enable the data cell validation in a textbox column for entering only none empty strings, which will disable the data validation and display the error indicator at the row header.
UI Controlsfor Windows Forms.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls