Skip to content

DevExpress-Examples/asp-net-web-forms-gridview-custom-buttons-in-batch-edit-mode

Repository files navigation

GridView for Web Forms - How to implement custom buttons in the status bar in batch edit mode

In batch edit mode, the Grid displays three buttons in the status bar: Preview changes, Save changes, and Cancel changes. You cannot change the behavior of the default buttons, but you can replace them with custom buttons. See the example below for details.

Grid View - Confirmation message

To replace the default buttons with custom buttons, implement the StatusBar template.

<Templates>
  <StatusBar>
    <dx:ASPxButton ClientInstanceName="btnPreview"... />
    <dx:ASPxButton ClientInstanceName="btnSave"... />
    <dx:ASPxButton ClientInstanceName="btnCancel"... />
  </StatusBar>
</Templates>

Handle the BatchEditEndEditing event and change the button visibility based on your conditions. In this example, custom buttons imitate the behavior of default buttons: they are hidden when the Grid has no changes and the Show changes button changes its text to Hide preview when clicked.

function SetButtonsVisibility(s) {
  var visibility = s.batchEditApi.HasChanges()
  btnPreview.SetVisible(visibility);
  btnSave.SetVisible(visibility);
  btnCancel.SetVisible(visibility);
}

function onPreviewChangesClick(s, e) {
  if (isPreviewChangesVisible) {
    s.SetText("Show changes");
    gridView.batchEditApi.HideChangesPreview();
  }
  else {
    s.SetText("Hide preview");
    gridView.batchEditApi.ShowChangesPreview();
  }
  isPreviewChangesVisible = !isPreviewChangesVisible;
}

Files to Look At

Documentation

More Examples

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

About

Implement custom buttons in the status bar in batch edit mode

Topics

Resources

License

Stars

Watchers

Forks

Contributors 6