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

[Solved] Problem while grouping

1 Answer 95 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
suresh
Top achievements
Rank 1
suresh asked on 14 Oct 2009, 09:34 AM
Hi,
         I am using a radgridview.I have arranged my rows in an order from the database.It is working fine.But when i group the data with any of the columns,then it is ordering in an ascending order.I don't want to order the items when grouped.Is there any way to achieve this task.

1 Answer, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 16 Oct 2009, 01:39 PM
Hello suresh,

You can change this behavior easily by attaching to the Grouping event of the grid and setting the SortDirection of the GroupDescriptor to null. Like this:

using System.ComponentModel;
using System.Windows.Controls;
 
namespace TicketID_250424_BringDataItemIntoView
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
 
            this.playersGrid.ItemsSource = Club.GetPlayers();
 
            this.playersGrid.Grouping += OnPlayersGridGrouping;
        }
 
        static void OnPlayersGridGrouping(object sender, Telerik.Windows.Controls.GridView.GridView.GridViewGroupingEventArgs e)
        {
            e.GroupDescriptor.SortDirection = null;
        }
    }
}

I have attached a sample project.

All the best,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
GridView
Asked by
suresh
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Share this question
or