Edit this page

Events

There are two events that are raised, when the data in the RadGridView is grouped. The first one is the GroupByChanging event which is raised before the data is grouped and he second one is the GroupByChanged event raised after the data is grouped.

void radGridView1_GroupByChanging1(object sender, Telerik.WinControls.UI.GridViewCollectionChangingEventArgs e)
{
    e.Cancel = true;
}

Private Sub RadGridView1_GroupByChanging1(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GridViewCollectionChangingEventArgs) Handles RadGridView1.GroupByChanging
    e.Cancel = True
End Sub

From the event arguments of both events you can access the following data:

  • Action: An enumeration with values: Add, Remove, ItemChanged and Reset.The Action property notifies if a GroupDescriptor is added, removed, modified or the GroupDescriptors collection is cleared.

  • NewItems: A List of added, edited or removedGroupDescriptors. For each GroupDescriptor you can get its GroupNames, Format, Aggregates and Expression.

You are also able to cancel the grouping operation by setting the Cancel property to True

void radGridView1_GroupByChanging1(object sender, Telerik.WinControls.UI.GridViewCollectionChangingEventArgs e)
{
    e.Cancel = true;
}

Private Sub RadGridView1_GroupByChanging1(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GridViewCollectionChangingEventArgs) Handles RadGridView1.GroupByChanging
    e.Cancel = True
End Sub

Since the GroupDescriptors collection implements the INotifyPropertyChanged interface, you can use its CollectionChanged event:

radGridView1.GroupDescriptors.CollectionChanged += new Telerik.WinControls.Data.NotifyCollectionChangedEventHandler(GroupDescriptors_CollectionChanged);

AddHandler Me.RadGridView1.GroupDescriptors.CollectionChanged, AddressOf GroupDescriptors_CollectionChanged

void GroupDescriptors_CollectionChanged(object sender, Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e)
{
}

Private Sub GroupDescriptors_CollectionChanged(ByVal sender As Object, ByVal e As Telerik.WinControls.Data.NotifyCollectionChangedEventArgs)
End Sub

The arguments of this event provide the same data as the GroupByChanged event.

See Also