Skip to main content
A newer version of this page is available. .

Step 5: Enable Data Editing

  • 2 minutes to read

You should enable data operations after you bind the GridControl to a virtual source.

In this step, we describe how to enable the data editing feature.

Note

The Issues Service is used as an example of a data source in this tutorial.

Run Demo: Infinite Scrolling Source - Step 5

Enable Data Editing

  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 save the changes to an underlying data source (database). To save the changes asynchronously, set the GridRowValidationEventArgs.UpdateRowResult property to a task that saves the changes.

<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);
    });
} 

Continue or Review