GridViewSettings.SetGroupRowContentTemplateContent(String) Method

Allows setting a template for displaying the content of group rows.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v20.2.dll


public void SetGroupRowContentTemplateContent(
    string content
Public Sub SetGroupRowContentTemplateContent(
    content As String


Name Type Description
content String

A string value specifying the template content.


@Html.DevExpress().GridView(settings => {
    settings => {
        settings.Name = "gridView";
        settings.SetGroupRowContentTemplateContent("<span style='color:red'>test</span>");

Online Demo

GridView - Templates



The complete sample project is available in the DevExpress Code Central example E3989. Depending on the target platform type (ASP.NET, WinForms, etc), you can either run this example online or download an auto-executable sample.

In this sample, two links are used: "Select All" and "Unselect All". When the end-user clicks these links, a custom callback is executed. In the grid's CustomCallback event handler, necessary actions are performed to select / unselect all rows that belong to the group row based on the link that was clicked.

@Html.DevExpress().GridView(settings => {
    settings.Name = "dxGridView";
    settings.KeyFieldName = "ProductID";
    settings.CallbackRouteValues = new { Controller = "Home", Action = "GridViewPartial" };

    settings.Columns.Add("CategoryID").GroupIndex = 0;
    settings.Columns.Add("Discontinued", MVCxGridViewColumnType.CheckBox);

    settings.CommandColumn.Visible = true;
    settings.CommandColumn.ShowSelectCheckbox = true;

    settings.Settings.ShowGroupPanel = true;
    settings.SetGroupRowContentTemplateContent(c => {
        var linkSelect = String.Format("<a onclick='SelectGroupedRows({0}, true);' href='javascript:void(0)'>Select All / </a>", c.VisibleIndex);
        var linkUnselect = String.Format("<a onclick='SelectGroupedRows({1}, false);' href='javascript:void(0)'>Unselect All Rows: {0}</a>", c.GroupText, c.VisibleIndex);

        var group = String.Format("{0}{1}", linkSelect, linkUnselect);

    settings.CustomCallback = (s, e) => {
        ASPxGridView grid = s as ASPxGridView;
        string[] data = e.Parameters.Split('|');

        int index = int.Parse(data[0]);
        bool value = bool.Parse(data[1]);
        if (data.Length == 2) {
            int startLevel = grid.GetRowLevel(index);
            int count = grid.VisibleRowCount;
            for (int i = 1 + index; i < count; i++) {
                grid.Selection.SetSelection(i, value);
                if (grid.GetRowLevel(i) <= startLevel)

See Also