TreeList.SetColumnError(TreeListColumn, String, ErrorType) Method

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

Namespace: DevExpress.XtraTreeList

Assembly: DevExpress.XtraTreeList.v20.1.dll


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


Name Type Description
column TreeListColumn

A TreeListColumn 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.


This method overload allows you to set an error of a specific error type for a cell within the focused node. Generally, you may need to set errors to cells while performing data validation via the TreeList.ValidatingEditor or TreeList.ValidateNode event.

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

If the control's data source is a DataView or a DataTable, you can set errors for individual rows using the SetColumnError method of data rows. The Tree List will also mark these rows with the error icon. Note however, that methods provided by the Tree List do not allow you to work with these 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.


Assume that there are two columns in a Tree List: "OrderDate" and "RequiredDate". The value in the first column must be less than the value in the second one. So we need to validate a node when it is about to be saved to the data source. For this purpose, the TreeList.ValidateNode event is handled.

If a node fails validation, we set errors for the columns with corresponding descriptions using the TreeList.SetColumnError method. The descriptions will be displayed when hovering over the error icons.

The TreeList.InvalidNodeException event is handled in order to suppress displaying the default error message box.

The following screenshot shows the Tree List after a node fails validation.


Note that the TreeListOptionsBehavior.ShowToolTips option must be enabled to allow tooltips to be displayed.

using DevExpress.XtraTreeList;

private void treeList1_ValidateNode(object sender, ValidateNodeEventArgs e) {
    DateTime time1 = (DateTime)e.Node[colOrderDate];
    DateTime time2 = (DateTime)e.Node[colRequiredDate];
    if(time1 >= time2) {
        e.Valid = false;
        //Set errors with specific descriptions for the columns
        treeList1.SetColumnError(colOrderDate, "The value must be less than RequiredDate");
        treeList1.SetColumnError(colRequiredDate, "The value must be greater than OrderDate");


private void treeList1_InvalidNodeException(object sender, InvalidNodeExceptionEventArgs e) {
    //Suppress displaying the error message box
    e.ExceptionMode = ExceptionMode.NoAction;
See Also