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 DesignWinForms UI Controls WinForms Buttons UI Control WinForms Calendar UI ControlWinForms Carousel UI ControlWinForms Chart UI ControlWinForms Clock UI ControlCommandBar UI ControlWinForms Dock UI ControlDesktop Alert UI ControlDropDown List UI ControlWinForms Editor UI ControlForms and Dialogs UI ControlWinForms GridView UI ControlGridView - Get Started in C#GridView - PropertiesGridView - ColumnGridView - RowGridView - CellsCells - AccessCells - PropertyCells - IterateCells - Conditional FormatCells - Format CellsCells - Set CellsCells - Painting & DrawingCells - Custom CellsGridView - EditorsEditors - PropertyEditors - EventsEditors - Data ValidationEditors - CustomizeGridView - Context MenuGridView - Populating with DataGridView - Hierarchical GridGridView - SelectionGridView - ScrollingGridView - SortingGridView - GroupingGridView - FilteringGridView - Expression EditorInsert/ Update/ Delete RecordsGridView - View DefinitionGridView - Exporting DataStyling and AppearanceGridView - LocalizationSave and Load LayoutGridView - Print SupportWinForms ListView UI ControlWinForms Menu UI ControlWinForms ComboBox UI ControlWinForms PageView UI ControlPanels and Labels UI ControlWinForms Panorama UI ControlWinForms PDFViewer UI ControlWinForms Property Grid UI ControlWinForms Ribbon UI ControlWinForms PivotGrid UI ControlWinForms RichTextBox UI ControlWinForms Rotator UI ControlWinForms Scheduler UI ControlWinForms Shortcuts UI ControlWinForms SpellChecker UI ControlWinForms Track & Status UI ControlWinForms TreeView UI ControlWinForms Wizard UI ControlWinForms Test UI ControlWinForms Theme UI Control |