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.CanceledIf set to True the event will be canceled.
-
(GridGroupsChangingAction)
e.ActionGets a reference to
GridGroupsChangingAction
enumeration, which holds information about what action did fire the event. (Group, Ungroup, Swap or ChangeSortOrder) -
(GridGroupByExpression)
e.ExpressionGets or sets the
GridGroupByExpression
that will be used for grouping. -
(GridGroupByField)
e.SortedFieldGets a reference to the currently used
GridGroupByField
-
(GridGroupByExpression)
e.SwapExpressionGets 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.TableViewGets a reference to the
GridTableView
object where the grouping is performed.
-
-
Attaching the event
In the Markup
<telerik:RadGrid ID="RadGrid1" runat="server" OnGroupsChanging="RadGrid1_GroupsChanging">
</telerik:RadGrid>
In the Code behind
protected void Page_Init(object sender, EventArgs e)
{
RadGrid1.GroupsChanging += RadGrid1_GroupsChanging;
}
The event handler
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;
}