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

Cancelling Grouping and Grouped

4 Answers 88 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.
ErrolM
Top achievements
Rank 1
ErrolM asked on 05 May 2011, 03:22 AM
Hello folks,

I read in http://www.telerik.com/help/silverlight/gridview-events-grouping.html that Grouping can be selectively canceled by setting cancel=true. I was not expecting the Grouped event to fire when I canceled but in my situation it does.

Is this by design or could I be doing something additional that causes the Grouped event to fire?

Cheers,
Errol

4 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 05 May 2011, 08:10 AM
Hello Errol,

 

May you please elaborate a little bit more about your current settings?
As described in our online documentation you may disable grouping functionality within RadGridView's Grouping event handler as shown below:

private void RadGridView_Grouping(object sender, Telerik.Windows.Controls.GridViewGroupingEventArgs e)
      {
         e.Cancel=true;
      }


Using this snippet you will not be able to perform grouping in RadGridView.
I believe that there is something specific in your case. Any additional information will be highly appreciated.


Regards,
Vanya Pavlova
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
Christian
Top achievements
Rank 1
answered on 09 Oct 2012, 08:02 PM
Hi,
I have the same issue.
I have a RadGridView listening two events: Grouping & Grouped.
When I cancel the grouping in the Grouping event, the grid doesn't continue with the grouping, but the Grouped event always is fired.
How I can know, in the Grouped event, if the grouping was cancelled in the previous event?

Thanks,
Christian
0
Nick
Telerik team
answered on 11 Oct 2012, 12:48 PM
Hi Chistian,

Here is a simple approach you can take:

void GridView_Grouped(object sender, Telerik.Windows.Controls.GridViewGroupedEventArgs e)
{
    if (this.isGroupingCanceled)
    {
        this.isGroupingCanceled = false;
        return;
    }
}
 
private bool isGroupingCanceled = false;
private int counter = 0;
void GridView_Grouping(object sender, Telerik.Windows.Controls.GridViewGroupingEventArgs e)
{
    if (counter++ % 2 == 0)
    {
        e.Cancel = this.isGroupingCanceled = true;
    }
}

Hope it helps!  Greetings,
Nik
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Christian
Top achievements
Rank 1
answered on 11 Oct 2012, 02:47 PM
Hi Nick,

Thanks for your suggestion; it's a little clumsy, but works.
Tags
GridView
Asked by
ErrolM
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Christian
Top achievements
Rank 1
Nick
Telerik team
Share this question
or