ColumnView.SetColumnError(GridColumn, String, ErrorType) Method
Sets an error description and an error type for the specified cell within the focused row.
public virtual void SetColumnError( GridColumn column, string errorText, ErrorType errorType )
Public Overridable Sub SetColumnError( column As GridColumn, errorText As String, errorType As ErrorType )
A GridColumn that identifies the cell to which an error is set.
A string value representing an error description. An empty string to clear the assigned error.
An ErrorType value that specifies the type of the error. Error types correspond to specific error icons.
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.
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.
- 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.