3 Answers, 1 is accepted
0
Hello jo,
There are a couple of ways to implement this requirement. One of them is to cancel the second grouping in the GroupsChanging event of Radgrid:
The above code checks if the current event is a group event, and cancels the event if there already is a group expression set.
Another approach you can take is to disable group dragging if there is a group expression already set:
Regards,
Veli
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
There are a couple of ways to implement this requirement. One of them is to cancel the second grouping in the GroupsChanging event of Radgrid:
| void RadGrid1_GroupsChanging(object source, Telerik.Web.UI.GridGroupsChangingEventArgs e) |
| { |
| if (e.Action == Telerik.Web.UI.GridGroupsChangingAction.Group) |
| { |
| if (RadGrid1.MasterTableView.GroupByExpressions.Count > 0) |
| e.Canceled = true; |
| } |
| } |
The above code checks if the current event is a group event, and cancels the event if there already is a group expression set.
Another approach you can take is to disable group dragging if there is a group expression already set:
| void RadGrid1_PreRender(object sender, EventArgs e) |
| { |
| if (RadGrid1.MasterTableView.GroupByExpressions.Count > 0) |
| RadGrid1.ClientSettings.AllowDragToGroup = false; |
| else |
| RadGrid1.ClientSettings.AllowDragToGroup = true; |
| } |
Regards,
Veli
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Accepted
Shinu
Top achievements
Rank 2
answered on 22 Sep 2008, 06:02 AM
Hi Jo,
You can try the following code snippet to clear the first grouping and add the new column in the Group panel on Drag and Drop.
CS:
Thanks
Shinu.
You can try the following code snippet to clear the first grouping and add the new column in the Group panel on Drag and Drop.
CS:
| protected void RadGrid1_GroupsChanging(object source, GridGroupsChangingEventArgs e) |
| { |
| if (e.Action == Telerik.Web.UI.GridGroupsChangingAction.Group) |
| { |
| if (RadGrid1.MasterTableView.GroupByExpressions.Count > 0) |
| RadGrid1.MasterTableView.GroupByExpressions.Clear(); |
| } |
| } |
Thanks
Shinu.
0
jo
Top achievements
Rank 1
answered on 26 Sep 2008, 08:49 PM
thanks!