BaseView.PostEditor() Method

Saves the modified cell value to the data source. If the GridOptionsView.RowAutoHeight setting is disabled, the currently active cell editor remains opened.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v20.1.dll

Declaration

public bool PostEditor()
Public Function PostEditor As Boolean

Returns

Type Description
Boolean

true if the value has been successfully saved to the data source; otherwise, false.

Remarks

NOTE

Detail pattern Views do not contain data and they are never displayed within XtraGrid. So, the PostEditor member must not be invoked for these Views. The PostEditor 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.

The code sample below illustrates how to save the value of a CheckEdit to the data source.


RepositoryItemCheckEdit checkEdit = new RepositoryItemCheckEdit();
checkEdit.EditValueChanged += repositoryItemCheckEdit_EditValueChanged;
gridControl1.RepositoryItems.Add(checkEdit);
gridView1.Columns["Marked"].ColumnEdit = checkEdit;

private void repositoryItemCheckEdit_EditValueChanged(object sender, System.EventArgs e)
{
    gridView1.PostEditor();
}

Note that a row that is being edited is not saved until focus moves to another grid row. Call the UpdateCurrentRow method to make sure the current row is saved.

private void repositoryItemCheckEdit_EditValueChanged(object sender, EventArgs e) {
    if(gridView.PostEditor()) {
        gridView.UpdateCurrentRow();
    }  
}
See Also