A newer version of this page is available. Switch to the current version.

InvalidRowExceptionEventArgs Class

Provides data for the GridViewBase.InvalidRowException event.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v18.2.dll


public class InvalidRowExceptionEventArgs :
Public Class InvalidRowExceptionEventArgs
    Inherits RowEventArgs
    Implements IInvalidRowExceptionEventArgs


The GridViewBase.InvalidRowException event allows you to override the default error presentation. This event occurs after the GridViewBase.ValidateRow event (provided that the focused row's validation has failed).

The event parameter's InvalidRowExceptionEventArgs.ExceptionMode property allows you to specify the action performed in response to entering an invalid value. You can display a message box with an error description, suppress any action, throw an exception or discard new data and revert to an old value. The error description can be specified using the InvalidRowExceptionEventArgs.ErrorText property.

An exception that raised this event is returned by the InvalidRowExceptionEventArgs.Exception property.

To learn more, see Row Validation.


This example shows how to check the validity of data entered by end-users into a data row. The GridViewBase.ValidateRow and GridViewBase.InvalidRowException events are handled to validate the focused row's data, and if it is invalid, prevent the row focus from being moved to another row until invalid values are corrected.

Since the Task class doesn't support error notifications, it implements the IDXDataErrorInfo interface, providing two members to get error descriptions for the entire row and for individual cells (data source fields). This displays error icons within cells with invalid values. Pointing to such an error icon displays a tooltip with an error description.


A complete sample project is available at https://github.com/DevExpress-Examples/how-to-validate-data-rows-e1593.

<Window x:Class="DXGrid_ValidateRow.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" Title="Window1" Height="300" Width="500">
        <dxg:GridControl x:Name="grid">
                <dxg:GridColumn FieldName="TaskName" />
                <dxg:GridColumn FieldName="StartDate" />
                <dxg:GridColumn FieldName="EndDate" />
                <dxg:TableView AutoWidth="True" ValidateRow="TableView_ValidateRow" InvalidRowException="TableView_InvalidRowException" />


See Also