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

GDBG sort by two columns

Thread ID:





69516 Oct 31,2007 08:20 AM UTC Nov 5,2007 01:22 PM UTC WinForms 3
Tags: GridControl
Asked On October 31, 2007 08:20 AM UTC

I have gdbg bounded to a dataview. Dataview is sorted by specific_column. When user click on column header data is sorted by user_clicked_column. I need to sort data after user click by two columns - first by specific_column and then by user_clicked_column. Is there a way to do this?


haneefm [Syncfusion]
Replied On October 31, 2007 02:36 PM UTC

Hi Valery,

The GridDataBoundGrid uses the sorting support from the DataView associated with the underlying datasource of the grid. If you want to do a multiple sort through the DataView in a Grid, you need to handle the CellClick event of the grid and set the DataView.Sort property on the datasource to sort by multiple columns. Below are the codes that shows this task.

// Get the DefaultViewManager of a underlying datasource.

DataView myDataView = this.Grid.DataSource as DataView;

// By default, the first column sorted ascending.

myDataView.Sort = "State, ZipCode DESC";
e.Handled = true;

GridDataBoundGrid has support for Multicolumn sorting, refer this KB article for more details.

Best regards,

Replied On November 2, 2007 07:07 AM UTC

But how in this case can I display sort icon in column headers?

Jisha Joy [Syncfusion]
Replied On November 5, 2007 01:22 PM UTC

Hi Valery,

Thank you for your update.

The sample in the mentioned KnowledgeBase article uses GridMultiColSortHelper class to perform the multicolumn sorting. Sort direction of each column is stored in the Tag property of the grid column header. Sort icon can be seen when we click on the column header for sorting.

Here is the screen shot of that sample that shows sort icons:

Please let me know if you have any questions.



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

or the page will be automatically redirected to 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