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.

GDBG sort by two columns

Thread ID:

Created:

Updated:

Platform:

Replies:

69516 Oct 31,2007 04:20 AM Nov 5,2007 08:22 AM Windows Forms 3
loading
Tags: GridControl
Valerij
Asked On October 31, 2007 04:20 AM

Hello,
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?

Thanks!

haneefm [Syncfusion]
Replied On October 31, 2007 10:36 AM

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.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=110



Best regards,
Haneef

Valerij
Replied On November 2, 2007 03:07 AM

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

Jisha Joy [Syncfusion]
Replied On November 5, 2007 08:22 AM

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:
shot.zip

Please let me know if you have any questions.

Thanks,
Jisha


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.

;