New to Telerik UI for WinFormsStart a free 30-day trial

Events

Updated over 6 months ago

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.

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

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

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

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

C#
radGridView1.GroupDescriptors.CollectionChanged += new Telerik.WinControls.Data.NotifyCollectionChangedEventHandler(GroupDescriptors_CollectionChanged);
C#
void GroupDescriptors_CollectionChanged(object sender, Telerik.WinControls.Data.NotifyCollectionChangedEventArgs e)
{
}

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

As of R1 2021 RadGridView offers two new events:

  • GroupSortChanging: Fires when the user changes the sorting of the group. The action can be canceled.
  • GroupSortChanged: Fires after the user has changed the sorting of the group.

The GridViewGroupSortChangingEventArgs gives you access to the GridViewTemplate, GroupDescriptor and the new ListSortDirection.

See Also

In this article
See Also
Not finding the help you need?
Contact Support