Xceed Grid for WinForms v4.3 Documentation
Welcome to Xceed Grid for WinForms v4.3 / Sample applications / EventValidation Sample Application
EventValidation Sample Application

Programming languages

VB.NET, C#

Overview

This application demonstrates how to validate the content of the grid at both the cell and row level (including InsertionRow). It handles both custom validation as well as validation handled by the underlying dataset.

Demonstrates

  • How to handle the EndingEdit event of an InsertionRow as well as for each DataRow in the grid (via the DataRowTemplate) to provide custom validation

  • How to handle the ValidationError event of an InsertionRow as well as for each DataRow  in the grid (via the DataRowTemplate) to prevent the row(s) from leaving edit mode in the case where the validation process fails. 

  • How to handle the EditEnded event of an InsertionRow as well as for each DataRow in the grid (via the DataRowTemplate) to commit modifications made to the grid to the physical data source. 

  • How to handle the LeavingEdit event of each DataCell in the grid (via the DataRowTemplate.Cells collection) to provide custom validation

  • How to handle the ValidationError event of each DataCell in the grid (via the DataRowTemplate.Cells collection) to prevent the cell(s) from leaving edit mode in the case where the validation process fails. 

  • How to provide custom error behaviors via the ErrorDescription property of both cell's and CellRow's.

How to use

This sample validates the content of the "CustomerID" and "Delivery Agency" columns to make sure that if the values of the cells in the "CustomerID" columns are "VINET", that only "Pickup" and "To be determined" can be selected in the "Delivery Agency" column.

Project location & filename

C#: Xceed Samples\Xceed Grid for WinForms v#.#\CSharp\EventValidation\ValidatingCS.csproj

VB.NET: Xceed Samples\Xceed Grid for WinForms v#.#\Visual Basic .NET\EventValidation\ValidatingVB.vbproj