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

Limit number of columns to group by?

4 Answers 89 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kjell
Top achievements
Rank 1
Kjell asked on 27 Sep 2010, 08:45 PM
Hi, is there a way to limit how many columns a user can group by?  I would like to limit them to 4 columns.

4 Answers, 1 is accepted

Sort by
0
Kjell
Top achievements
Rank 1
answered on 27 Sep 2010, 09:04 PM
Ok I figured out I can look at the groupcount and then cancel additional grouping in the "Grouping" event, but is there a better way?
0
Vlad
Telerik team
answered on 28 Sep 2010, 07:24 AM
Hello Kjell,

 Currently this is the only way (Grouping event) to achieve this.

Kind regards,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Trupti
Top achievements
Rank 1
answered on 19 Jun 2012, 11:04 AM
Hi , can you please provide the code you have used to limit the columns to group by?
0
Kjell
Top achievements
Rank 1
answered on 19 Jun 2012, 02:51 PM
Sure, the name of my grid is "rgvEvents" and this is my "Grouping" event handler.


void rgvEvents_Grouping(object sender, GridViewGroupingEventArgs e)
        {
            try
            {
                //don't allow more than 3 groups at a time
                if (rgvEvents.GroupCount > 3 && e.Action == Telerik.Windows.Controls.GroupingEventAction.Place)
                {
                    e.Cancel = true;
                }
            }
            catch { }
        }






Tags
GridView
Asked by
Kjell
Top achievements
Rank 1
Answers by
Kjell
Top achievements
Rank 1
Vlad
Telerik team
Trupti
Top achievements
Rank 1
Share this question
or