Skip to main content
Tab

GridViewTemplates.GroupRowContent Property

Specifies a template to display the group row content.

Namespace: DevExpress.Web

Assembly: DevExpress.Web.v24.1.dll

NuGet Package: DevExpress.Web

Declaration

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

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.

View Example: How to select/deselect all rows in a group when Grid View data is grouped by one column View Example: How to display group summary in group headers

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