Skip Navigation LinksHome / Community & Support / Code Library / ASP.NET and ASP.NET AJAX > Grid > Grouping single column at a time

Grouping single column at a time

Feed from this thread
  • Posted on Mar 16, 2006 (permalink)

     

    Requirements

    RadGrid for ASP .NET version

    RadControls for ASP .NET AJAX version

    3.0.3 and later


    2008.1.415 and later

    .NET version

    2.0 and later

    Visual Studio version

    2005 and later

    Programming language

    C#

    Browser support

    all supported by RadGrid for ASP .NET


    all browsers supported by RadControls for ASP .NET AJAX


    To enable grouping of a single column at a time:

    1. hook the GroupsChanging event of r.a.d.grid
    2. in the respective event handler determine where the current action is dropping column in the group panel
    3. if this is the case and the GroupByExpressions collection of the grid is not empty
      - cancel the default action
      - clear the GroupByExpression collection
      - add the current expression (hold by the e.Expression argument) to that collection
    4. rebind the grid calling its Rebind() method

     

    Reply

  • krefftc avatar

    Posted on Feb 1, 2007 (permalink)

    Is there source code for the .NET 1.1?

    Reply

  • Yavor Yavor admin's avatar

    Posted on Feb 2, 2007 (permalink)

    Hi Krefftc,

    Basically, the approach will be the same. The only difference would be that you will need to use NeedDataSource, instead of the AccessDataSource. The rest of the functionality is handled in the GroupsChanging event handler, as shown below:

    .cs
    protected void RadGrid1_GroupsChanging(object source, GridGroupsChangingEventArgs e)  
        {  
            if (e.Action == GridGroupsChangingAction.Group)  
            {  
                if (RadGrid1.MasterTableView.GroupByExpressions.Count > 0)  
                {  
                    e.Canceled = true;  
                    RadGrid1.MasterTableView.GroupByExpressions.Clear();  
                    RadGrid1.MasterTableView.GroupByExpressions.Add(e.Expression);  
                }  
     
                RadGrid1.MasterTableView.Rebind();  
            }  
        } 

    I hope this helps.

    Have a nice day,
    Yavor

    the telerik team

    Reply

  • Mohammed avatar

    Posted on Jul 20, 2011 (permalink)

    Dear,

    Can I hide the group panel.


    Regards,

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Code Library / ASP.NET and ASP.NET AJAX > Grid > Grouping single column at a time