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

sort unbound column in GridDataBoundGrid

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

2 Replies

AD Administrator Syncfusion Team 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

AP Annegret Petzold November 11, 2004 09:03 AM UTC

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

Live Chat Icon For mobile
Up arrow icon