GridViewColumn.HeaderCaptionTemplate Property
Gets or sets a template for displaying the column header’s caption.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v19.2.dll
Declaration
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>
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the HeaderCaptionTemplate property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.