Back to Devexpress

Template Replacements

aspnetbootstrap-118819-grid-view-templates-template-replacements.md

latest3.5 KB
Original Source

Template Replacements

  • Oct 29, 2020
  • 4 minutes to read

When you create a template, you often need to only extend the base control functionality. The BootstrapGridViewTemplateReplacement control is designed to help you easily customize the edit form and pager bar while keeping regular controls (edit cells, Update and Cancel buttons, pager). It allows you to put template replacements keeping the base control functionality into your templates. The ASPxGridViewTemplateReplacement.ReplacementType property specifies the controls that are displayed by the BootstrapGridViewTemplateReplacement control.

The table below contains a list of the ReplacementType property values, the template types it can be used in and controls it contains.

ReplacementType property valueTemplate typeContained controls
EditFormContentGridViewTemplates.EditFormEdit form’s entire contents (edit cells and buttons)
EditFormEditorsGridViewTemplates.EditFormEdit cell of each field within a grid
EditFormCellEditorGridViewTemplates.EditFormEdit cell
EditFormUpdateButtonGridViewTemplates.EditFormUpdate button
EditFormCancelButtonGridViewTemplates.EditFormCancel button
PagerGridViewTemplates.PagerBarPager

Edit form template replacements

Edit form template replacements allow you to add regular controls to an edit form template. Note that the regular form editors created by the BootstrapGridViewTemplateReplacement control are automatically validated on the client if their validation settings are defined on a column level.

  • Edit form’s entire content template replacement

  • Template replacement of every edit cell

  • An edit cell template replacement

  • Update and Cancel buttons template replacements

Pager template replacement

Set the ASPxGridViewTemplateReplacement.ReplacementType property to GridViewTemplateReplacementType.Pager to get a pager within your template. Note you can use this type of template replacement within the GridViewTemplates.PagerBar template only.

aspx
<Templates>
    <PagerBar>
        <div class="row">
            <div class="col-md-10">
                <dx:BootstrapGridViewTemplateReplacement ID="GridViewTemplatePager" ReplacementType="Pager" runat="server"></dx:ASPxGridViewTemplateReplacement>
            </div>
            ...
        </div>
    </PagerBar>
</Templates>