All docs
V20.1
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

GridRowValidationEventArgs.UpdateRowResult Property

Gets or sets a task that allows you to asynchronously post changes to an underlying data source (database).

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v20.1.Core.dll

Declaration

public Task UpdateRowResult { get; set; }
Public Property UpdateRowResult As Task

Property Value

Type Description
Task

A task that allows you to asynchronously post changes to an underlying data source (database).

Remarks

TIP

Demo: Virtual Sources - Editing

Requires a WPF Subscription. Download

  1. Set the ColumnBase.AllowEditing property to true for the columns that end users can edit.

  2. Set the TableView.ShowUpdateRowButtons property to OnCellEditorOpen / OnCellValueChange to enable Edit Entire Row mode.

  3. Handle the GridViewBase.ValidateRow event and set the UpdateRowResult property to a task that asynchronously saves the changes to an underlying data source (database).

<dxg:GridControl x:Name="grid">
    <dxg:GridControl.Columns>
        <dxg:GridColumn FieldName="Subject" IsSmart="True" AllowEditing="true"/>
        <dxg:GridColumn FieldName="User" IsSmart="True" AllowEditing="true"/>
        <dxg:GridColumn FieldName="Created" IsSmart="True" AllowEditing="true"/>
        <dxg:GridColumn FieldName="Votes" IsSmart="True" AllowEditing="true"/>
        <dxg:GridColumn FieldName="Priority" IsSmart="True" AllowEditing="true"/>
    </dxg:GridControl.Columns>
    <dxg:GridControl.View>
        <dxg:TableView ValidateRow="TableView_ValidateRow" ShowUpdateRowButtons="OnCellValueChange" />
    </dxg:GridControl.View>
</dxg:GridControl> 
private void TableView_ValidateRow(object sender, GridRowValidationEventArgs e) {    
    e.UpdateRowResult = Task.Run(() => {      
        IssuesService.UpdateRow(e.Row as IssueData);
    });
} 

Use the ValidationEventArgs.IsValid property to specify whether a row's values are valid. Use the ValidationEventArgs.ErrorType and ValidationEventArgs.ErrorContent properties to display an error message.

private void TableView_ValidateRow(object sender, GridRowValidationEventArgs e) {    
    e.UpdateRowResult = Task.Run(() => {      
        if (!IssuesService.ServerIsConnected) {
            e.IsValid = false;
            e.ErrorContent = "Server is disconnected.";
            e.ErrorType = DevExpress.XtraEditors.DXErrorProvider.ErrorType.Critical;
            return;
        }
        IssuesService.UpdateRow(e.Row as IssueData);
    });
} 

To allow users to cancel the Update operation, set the GridRowValidationEventArgs.UseCancellationToken property to true and use the GridRowValidationEventArgs.CancellationToken in a cancel function.

See Also