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.v24.2.dll
Declaration
public virtual void SetColumnError(
GridColumn column,
string errorText,
ErrorType 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 Views that display real data within the Grid Control. Use the following methods to access these Views with which an end user interacts at runtime.
- GridControl.MainView - returns the top most View in a grid;
- GridControl.FocusedView - returns the focused View;
- GridControl.DefaultView - returns the currently maximized View;
- the sender parameter of View specific events;
- GridView.GetDetailView - returns a detail clone View for a specific master row.