This is a migrated thread and some comments may be shown as answers.

GroupPanel

3 Answers 68 Views
Grid
This is a migrated thread and some comments may be shown as answers.
jo
Top achievements
Rank 1
jo asked on 16 Sep 2008, 11:01 PM
I'm using GroupPanel for grouping and it's on the client side.I just want to limit one column at a time to group. For the second column header drag and drop should clear the first grouping and add do the second column .

3 Answers, 1 is accepted

Sort by
0
Veli
Telerik team
answered on 18 Sep 2008, 12:45 PM
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:

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:
 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!
Tags
Grid
Asked by
jo
Top achievements
Rank 1
Answers by
Veli
Telerik team
Shinu
Top achievements
Rank 2
jo
Top achievements
Rank 1
Share this question
or