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

sort unbound column in GridDataBoundGrid

Thread ID:





21427 Nov 10,2004 09:15 AM UTC Nov 11,2004 09:03 AM UTC WinForms 2
Tags: GridControl
Annegret Petzold
Asked On November 10, 2004 09:15 AM UTC

Hi, I have a GridDataBoundGrid with unbound columns. in this columns i show values from a second table. How can I sort on this columns? Please help. Thanks, Anne

Administrator [Syncfusion]
Replied On November 10, 2004 10:44 AM UTC

You would have to manage this on your own. GridDataBoundGrid relies on DataView.Sort to sort things, so it cannot use its default sorting support to sort an unbound column. Here is one way you can do this. You can turn off the grid''s default sorting, and handle all sorting yourself. You can use an ArrayList of row indexes to specify the row to be shown in a particular grid row position. Then changing these index values will effectively change the row order in the grid. Once you have this arraylist set up, you can use ArrayList.Sort to sort things, passing in a custom comparer that makes the comparison''s based on the column values from the datasource. Here is a little sample (work in progress - still may have some glitches) that wraps all this up into a helper class that allows custom sorting of a GridDataBoundGrid. The helper class also supports sorting an unbound column as well. Maybe something like this will work for you. GridDataBoundGridCustomSorting_6960.zip

Annegret Petzold
Replied On November 11, 2004 09:03 AM UTC

Hi, Clay, It was perfect. Thank you very much. Anne.


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

Live Chat Icon For mobile
Live Chat Icon