ColumnView.SetColumnError(GridColumn, String, ErrorType) Method

Sets an error description and an error type for the specified cell within the focused row.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v20.1.dll

Declaration

public virtual void SetColumnError(
    GridColumn column,
    string errorText,
    ErrorType errorType
)
Public Overridable Sub SetColumnError(
    column As GridColumn,
    errorText As String,
    errorType As ErrorType
)

Parameters

Name Type Description
column GridColumn

A GridColumn that identifies the cell to which an error is set.

errorText String

A string value representing an error description. An empty string to clear the assigned error.

errorType ErrorType

An ErrorType value that specifies the type of the error. Error types correspond to specific error icons.

Remarks

This method overload allows you to set an error of a specific error type for a cell within the focused row. Generally, you may need to set errors to cells while performing data validation via the ColumnView.ValidateRow event.

When an error is set to a cell, an error icon is automatically displayed. Its type is specified by the errorType parameter.

If a View's data source is a DataView or a DataTable, you can set errors for individual rows using the SetColumnError method of data rows. The View will also mark these rows with the error icon. Note however, that methods provided by the ColumnView class do not allow you to work with such errors. Instead, use members provided by the DataRow object to handle errors assigned in this manner.

In order to provide error support for IList data sources, you need to implement the IDataErrorInfo or IDXDataErrorInfo interface. Refer to the Implementing ErrorInfo Support for Data Sources document for details.

The SetColumnError method does not set errors for fields displayed in the edit form when the GridOptionsEditForm.BindingMode option is set to Cached.

NOTE

Detail pattern Views do not contain data and they are never displayed within XtraGrid. So, the SetColumnError member must not be invoked for these Views. The SetColumnError member can only be used with real Views that are displayed within the Grid Control. The real Views with which an end-user interacts at runtime can be accessed using the following methods.

See Also