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

Gridview Group By

3 Answers 148 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 2
Scott asked on 15 Jan 2010, 07:46 PM
Hello hopefully someone can help me.  I'm looking to do a group by on the gridview control, but I don't want it user expandable.  I want it to already be expanded not allowing the user for collapse and look like the file attached.  Does anyone know how to control this with the Telerik GridView?

Any help would be greatly appreciated.

3 Answers, 1 is accepted

Sort by
0
Jack
Telerik team
answered on 18 Jan 2010, 08:31 AM
Hi Scott,

You can expand all groups by setting AutoExpandGroups property to true and you can hide the group headers by setting GroupHeaderHeight to 0. Here is a sample:

this.radGridView1.MasterGridViewTemplate.AutoExpandGroups = true;
((GridTableElement)this.radGridView1.GridElement).GroupHeaderHeight = 0;

Currently it is not possible to merge cells between rows. So, you can't achieve the layout from the picture. We have in mind this feature and it will be implemented in one of our upcoming releases. Should you have any other questions, please write back.

Regards,

Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Scott
Top achievements
Rank 2
answered on 19 Jan 2010, 08:33 PM
Is There a way I can do this grouping, and  not allow the users to change/modify the grouping that I set in the program?  It seems that if I turn EnableGrouping=False off so the users can't change grouping then the grid doesn't group when I conduct it programatically.
0
Jack
Telerik team
answered on 20 Jan 2010, 08:52 AM
Hello Scott,

You can hide the group panel by setting ShowGroupPanel property to false. You can also disable the context menu item when handling ContextMenuOpening event:

this.radGridView1.MasterGridViewTemplate.GroupByExpressions.Add("Value GroupBy Value");
this.radGridView1.MasterGridViewTemplate.AutoExpandGroups = true;
this.radGridView1.ShowGroupPanel = false;
this.radGridView1.ContextMenuOpening += new ContextMenuOpeningEventHandler(radGridView1_ContextMenuOpening);
 
void radGridView1_ContextMenuOpening(object sender, ContextMenuOpeningEventArgs e)
{
    GridHeaderCellElement cell = e.ContextMenuProvider as GridHeaderCellElement;
    if (cell != null)
    {
        e.ContextMenu.Items.RemoveAt(6);
    }
}

I hope this helps.

Greetings,

Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
Scott
Top achievements
Rank 2
Answers by
Jack
Telerik team
Scott
Top achievements
Rank 2
Share this question
or