This is a migrated thread and some comments may be shown as answers.

Hide Grid grouping header

5 Answers 513 Views
Grid
This is a migrated thread and some comments may be shown as answers.
adi
Top achievements
Rank 1
adi asked on 23 Feb 2012, 01:04 PM
Hello
I am using the RadGrid shown in the following page: http://demos.telerik.com/aspnet-ajax/grid/examples/groupby/headerandfootertemplates/defaultcs.aspx and I was wondering if there is any posibility to hide the grouping header, because I am implicitly grouping the grid values after a column all the time.
Thank you

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 Feb 2012, 01:12 PM
Hello,

Try the following code.
C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
 if (e.Item is GridGroupHeaderItem)
 {
 GridGroupHeaderItem item = (GridGroupHeaderItem)e.Item;
 item.Visible = false;
 }
}

-Shinu.
0
adi
Top achievements
Rank 1
answered on 23 Feb 2012, 01:19 PM
Thanks for the help...but it is not working...
I can't hide the fields displayed in this section:
<GroupByExpressions>
                <telerik:GridGroupByExpression>
                    <GroupByFields>
                        <telerik:GridGroupByField FieldName="ProductName" />
                    </GroupByFields>
                    <SelectFields>
                        <telerik:GridGroupByField FieldName="ProductName" HeaderText="Product name" />
                    </SelectFields>
                </telerik:GridGroupByExpression>
            </GroupByExpressions>
0
Andrey
Telerik team
answered on 24 Feb 2012, 05:44 PM
Hello,

In order to achieve your goal you need to change the PreRender event of RadGrid a bit. You need iterate through the Items collection of RadGrid's MasterTableView object and get the GroupHeaderItems. Then for each header item you need to set its visible property to false.

I have created sample project to illustrate the aforementioned approach. Give it a try and check whether this is the desired behavior.

Regards,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Andrey
Telerik team
answered on 24 Feb 2012, 05:44 PM
Hello,

In order to achieve your goal you need to change the PreRender event of RadGrid a bit. You need to iterate through the Items collection of RadGrid's MasterTableView object and get the GroupHeaderItems. Then for each header item you need to set its visible property to false.

I have created sample project to illustrate the aforementioned approach. Give it a try and check whether this is the desired behavior.

Regards,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
adi
Top achievements
Rank 1
answered on 27 Feb 2012, 10:40 AM
Thank you. Problem solved
Tags
Grid
Asked by
adi
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
adi
Top achievements
Rank 1
Andrey
Telerik team
Share this question
or