We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GGC Sorting Header Row

Thread ID:





82652 Jun 18,2009 09:28 AM UTC Jun 26,2009 11:49 AM UTC WinForms 4
Tags: GridControl
samanvay Gupta
Asked On June 18, 2009 09:28 AM UTC


Can you please help me to sort header row of GGC.
I want to sort header row using a field which is in the same datasource but not binded to the header or child row.

Here is the code I am using to bind the GGC

grdWbsTask.DataSource = ProjectScopeManager.ScopeSubTaskDT;
grdWbsTask.ChildGroupOptions.CaptionText = "{Category}";

GridColumnDescriptor subTaskName = new GridColumnDescriptor();
subTaskName.Name = "name";
subTaskName.MappingName = "name";
subTaskName.HeaderText = "Name";

GridColumnDescriptor constantHours = new GridColumnDescriptor();
constantHours.Name = "loe_constant_hours";
constantHours.MappingName = "loe_constant_hours";
constantHours.HeaderText = "LOE(Hours)";


Lingaraj S [Syncfusion]
Replied On June 20, 2009 11:29 AM UTC

Hi Samanvay,

Thank you for your interest in Syncfusion product.

I am unable to reproduce the issue in sorting, when the column has been added manually in GridGroupingControl. I have created the sample with specified your code in GridGroupingControl, the header sorting had performed in GridGroupingControl. Also I have attached the sample in below link:

This sample shows the sorting in GridGroupingControl.

Please try this sample, let me know if I misunderstood the query.

Lingaraj S.

samanvay Gupta
Replied On June 22, 2009 10:52 AM UTC

Hi Lingaraj,

Thanks for your quick comment on this. I probably could not explain the problem correctly.

Attached is the sample which I have created to explain the problem. In this sample I would like to sort header row (currently 3 rows) programmatically by "task index" field. Currently header rows are sorted based on thier caption.

task index field is associated with child rows but it will remain same for all the rows of that group



samanvay Gupta
Replied On June 25, 2009 07:29 AM UTC

Hi Lingaraj,

I would really appreciate if you look into this ASAP.


Lingaraj S [Syncfusion]
Replied On June 26, 2009 11:49 AM UTC

Hi Samanvay,

Thank you for the update.

If you want to sort grouped column by clicking another column, then please try using ListSortSortDirection property in GroupedColumns by applying in TableControlCellClick event to achieve this behavior.

Refer the code below:

void gridGroupingControl1_TableControlCellClick(object sender, GridTableControlCellClickEventArgs e)
GridTableCellStyleInfo sty = this.gridGroupingControl1.TableControl.GetTableViewStyleInfo(e.Inner.RowIndex, e.Inner.ColIndex);
if (sty.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell && sty.TableCellIdentity.Column.Name == "task_index")
System.ComponentModel.ListSortDirection sort= this.gridGroupingControl1.TableDescriptor.GroupedColumns["group"].SortDirection;
if (sort == ListSortDirection.Ascending)
sort = ListSortDirection.Descending;
this.gridGroupingControl1.TableDescriptor.GroupedColumns["group"].SortDirection = sort;
sort = ListSortDirection.Ascending;
this.gridGroupingControl1.TableDescriptor.GroupedColumns["group"].SortDirection = sort;
e.Inner.Cancel = true;

Refer the modified sample in below link:

Please let me know if you have any queries.

Lingaraj S.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon