New to Telerik UI for ASP.NET AJAXStart a free 30-day trial

GroupsChanging Event

Fired when Telerik RadGrid tries to group its data (e.g. when a column header is dragged to the Group Panel).

Event Parameters

  • (object) sender

    • The control that fires the event
  • (GridGroupsChangingEventArgs) e

    • Event arguments

      • (boolean) e.Canceled

        If set to True the event will be canceled.

      • (GridGroupsChangingAction) e.Action

        Gets a reference to GridGroupsChangingAction enumeration, which holds information about what action did fire the event. (Group, Ungroup, Swap or ChangeSortOrder)

      • (GridGroupByExpression) e.Expression

        Gets or sets the GridGroupByExpression that will be used for grouping.

      • (GridGroupByField) e.SortedField

        Gets a reference to the currently used GridGroupByField

      • (GridGroupByExpression) e.SwapExpression

        Gets the swap expression which represents the GridGroupByExpression with which the GridGroupsChangingEventArgs.Expression will be swapped. The only case the value is not null is when the Action property is set to Swap

      • (GridTableView) e.TableView

        Gets a reference to the GridTableView object where the grouping is performed.

Attaching the event

In the Markup

ASP.NET
<telerik:RadGrid ID="RadGrid1" runat="server" OnGroupsChanging="RadGrid1_GroupsChanging">
</telerik:RadGrid>

In the Code behind

C#
protected void Page_Init(object sender, EventArgs e)
{
    RadGrid1.GroupsChanging += RadGrid1_GroupsChanging;
}

The event handler

C#
protected void RadGrid1_GroupsChanging(object sender, GridGroupsChangingEventArgs e)
{
    GridGroupsChangingAction action = e.Action;
    bool canceled = e.Canceled;
    GridGroupByExpression expression = e.Expression;
    GridGroupByField sortedFiled = e.SortedField;
    GridGroupByExpression swapExpression = e.SwapExpression;
    GridTableView tableView = e.TableView;
}

See Also