Tab

GridViewColumn.HeaderCaptionTemplate Property

Gets or sets a template for displaying the column header’s caption.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v21.1.dll

Declaration

[DefaultValue(null)]
public virtual ITemplate HeaderCaptionTemplate { get; set; }

Property Value

Type Default Description
ITemplate

null

An object that implements the ITemplate interface.

Remarks

To provide a common template for displaying captions of column headers, use the GridViewTemplates.HeaderCaption property.

NOTE

Once a template defined via the HeaderCaptionTemplate property is created within a control, it is instantiated within a container object of the GridViewHeaderTemplateContainer type. This container object exposes a set of specific properties to which the template’s child controls can be bound.

Example

For a full example, see ASPxGridView - How to specify HeaderCaptionTemplate and prevent the default mouse actions.

<dx:ASPxGridView ID="grid" runat="server" AutoGenerateColumns="False" DataSourceID="ads" KeyFieldName="ProductID">
     <Columns>
          <dx:GridViewDataTextColumn FieldName="ProductID" ReadOnly="True" VisibleIndex="0">
               <EditFormSettings Visible="False" />
          </dx:GridViewDataTextColumn>
          <dx:GridViewDataTextColumn FieldName="ProductName" VisibleIndex="1">
          </dx:GridViewDataTextColumn>
          <dx:GridViewDataComboBoxColumn FieldName="CategoryID" VisibleIndex="2">
               <PropertiesComboBox ValueType="System.Int32" TextField="CategoryName" ValueField="CategoryID" />
               <HeaderCaptionTemplate>
                    <div onmousedown="return CancelEvent(event)" onmouseup="return CancelEvent(event)">
                         <dx:ASPxComboBox ID="cmb" runat="server" DataSourceID="dsCmb" ValueType="System.String"
                            TextField="CategoryName" ValueField="CategoryID">
                              <ClientSideEvents SelectedIndexChanged="OnSelectedIndexChanged" />
                         </dx:ASPxComboBox>
                    </div>
               </HeaderCaptionTemplate>
          </dx:GridViewDataComboBoxColumn>
          <dx:GridViewDataTextColumn FieldName="UnitPrice" VisibleIndex="3">
          </dx:GridViewDataTextColumn>
     </Columns>
</dx:ASPxGridView>
See Also