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. Image for the cookie policy date

Avoid sorting of header rows at the time of binding of data to GGC

Hi,

I am facing one problem in GridGrouping control.When i bind data to GGC, all the header row are sorted by default on the basis of GroupColumn.I don't want this default behaviour. Please help me.

Here is the code I am using to bind the GGC:

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

grdWbsTask.TableDescriptor.GroupedColumns.Add("group");
GridColumnDescriptor subTaskName = new GridColumnDescriptor();
subTaskName.Name = "name";
subTaskName.MappingName = "name";
subTaskName.HeaderText = "Name";
grdWbsTask.TableDescriptor.Columns.Add(subTaskName);

GridColumnDescriptor constantHours = new GridColumnDescriptor();
constantHours.Name = "loe_constant_hours";
constantHours.MappingName = "loe_constant_hours";
constantHours.HeaderText = "LOE(Hours)";
grdWbsTask.TableDescriptor.Columns.Add(constantHours);

When i bind data to GGC ,all header rows are sorted by default on the basis of "group" column.


Thanks,
Awanish Kaul



GGCControl_3e96c1fb_bcc31efa.zip

1 Reply

JJ Jisha Joy Syncfusion Team June 26, 2009 06:34 AM UTC

Hi Awanish,

Thank you for your interest in Syncfusion products.

The Grouping is followed by sorting in GridGroupingControl. This is by design. You cannot prevent sorting when the column is grouped. However, it is possible to control the sorting order by adding a custom Comparer to the SortColumnDescriptor. Here is a minimal sample to do this.
http://files.syncfusion.com/support/Grid.Windows/57240.zip

You can modify the sorting order by customizing the Comparer method in the way you want.
Here is a forum link that discusses on how to use the custom sort while grouping.
http://www.syncfusion.com/Support/forums/message.aspx?MessageID=29221

Please let me know if this helps.

Regards,
Jisha

Loader.
Live Chat Icon For mobile
Up arrow icon