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

How do you prevent clicking of the header from sorting the ggc

Thread ID:





53576 Dec 15,2006 06:31 PM UTC Dec 21,2006 07:14 AM UTC WinForms 3
Tags: Grouping
James Blibo
Asked On December 15, 2006 06:31 PM UTC

How to I disabled sorting in the grid from the UI. I want to prevent the grid from sorting when the user click on the header but still be able to do it programatically!

Administrator [Syncfusion]
Replied On December 18, 2006 06:18 AM UTC

Hi James,

This can be achieved by setting the AllowSortColumns property to false. This disables the sorting of columns in User Interface, it also allows to sort programmatically. The following is the code snippet.

// Form_Load event
this.gridGroupingControl1.TableOptions.AllowSortColumns = false; // Disable Sorting in UI

Also please refer to our shipped browser sample 'SortingMethods' [ \\windows\Grid.Grouping.Windows\Samples\Sorting\SortingMethods ] for more details.

Thank you for being patience.

Best regards,

James Blibo
Replied On December 21, 2006 02:59 AM UTC

Actually, my question was wrong... I want to selectively permit certain columns to be sortable and other to not be sortable. The solution that you provided is an all or nothing.

Administrator [Syncfusion]
Replied On December 21, 2006 07:14 AM UTC

Hi James,

Thanks for your response. This can be achieved by handling the TableControlQueryAllowSortColumn event and cancel the sorting for the required columns.

Please try the following code snippet and let us know if you need any further assistance.
>>>>>>>>>>>>>>>>>Code Snippet 1<<<<<<<<<<<<<<<<<<<
// Form_Load Event
this.gridGroupingControl1.TableOptions.AllowSortColumns = true;
this.gridGroupingControl1.TableControlQueryAllowSortColumn += new GridQueryAllowSortColumnEventHandler(gridGroupingControl1_TableControlQueryAllowSortColumn);
// TableControlQueryAllowSortColumn Event
void gridGroupingControl1_TableControlQueryAllowSortColumn(object sender, GridQueryAllowSortColumnEventArgs e)
if (e.Column.Name == "Length")
e.AllowSort = false;

Have a nice day.

Best regards,


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