GridViewTemplates.GroupRowContent Property
In This Article
Specifies a template to display the group row content.
Namespace: DevExpress.Web
Assembly: DevExpress.Web.v24.2.dll
#Declaration
#Property Value
Type | Default | Description |
---|---|---|
ITemplate | null | An object that implements the ITemplate interface. |
#Remarks
When you specify the GroupRowContent
property, the control creates a template within a container object of the GridViewGroupRowTemplateContainer type.
Refer to the Create Templates topic for information on how to create templates for the Grid View control’s elements.
#Example
In the example below, the group row content template contains ASPxCheckBox to expand/collapse grid groups.
<dx:ASPxGridView ID="ASPxGridView1" runat="server" ClientInstanceName="grid" AutoGenerateColumns="False">
<Settings ShowGroupButtons="False" ShowGroupPanel="True" />
<Columns>
<dx:GridViewDataTextColumn FieldName="ProductID" ReadOnly="True" VisibleIndex="0">
<EditFormSettings Visible="False" />
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn FieldName="ProductName" VisibleIndex="1" />
<dx:GridViewDataTextColumn FieldName="CategoryID" VisibleIndex="2" GroupIndex="0"
SortIndex="0" SortOrder="Ascending" />
<dx:GridViewDataTextColumn FieldName="UnitPrice" VisibleIndex="3" />
<dx:GridViewDataTextColumn FieldName="UnitsInStock" VisibleIndex="4" />
</Columns>
<Templates>
<GroupRowContent>
<dx:ASPxCheckBox ID="ASPxCheckBox1" runat="server" OnInit="ASPxCheckBox1_Init" />
<%# Container.GroupText + Container.KeyValue%>
</GroupRowContent>
</Templates>
</dx:ASPxGridView>
function ExpandCollapse(sender, index) {
if (sender.GetChecked())
grid.ExpandRow(index);
else
grid.CollapseRow(index);
}
protected void ASPxCheckBox1_Init(object sender, EventArgs e) {
ASPxCheckBox cb = sender as ASPxCheckBox;
GridViewGroupRowTemplateContainer container = cb.NamingContainer as GridViewGroupRowTemplateContainer;
if (ASPxGridView1.IsRowExpanded(container.VisibleIndex))
cb.Checked = true;
cb.ClientSideEvents.CheckedChanged = string.Format("function (s, e) {{ ExpandCollapse(s, {0}); }}", container.VisibleIndex);
}
See Also