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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

53576 Dec 15,2006 01:31 PM Dec 21,2006 02:14 AM Windows Forms 3
loading
Tags: Grouping
James Blibo
Asked On December 15, 2006 01:31 PM

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 01:18 AM

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
this.gridGroupingControl1.TableDescriptor.SortedColumns.Add("ParentName",ListSortDirection.Ascending);
>>>>>>>>

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,
Madhan

James Blibo
Replied On December 20, 2006 09:59 PM

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 02:14 AM

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,
Madhan

CONFIRMATION

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.

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.

;