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

custom sorting in GridDataBoundGrid

Thread ID:





72623 Mar 28,2008 10:58 AM UTC Mar 28,2008 05:15 PM UTC WinForms 1
Tags: GridControl
Asked On March 28, 2008 10:58 AM UTC

Hi All,

How can i do custom sorting for one column which could be moved by user during work(so, it could be with different col index). I need help exactly with GridDataBoundGrid, cause all examples i found are with another types of grids . I know that need to use IComparer, but i cant find how to link it to GridDataBoundGrid and how to find needed column(i know her name and have instance of GridBoundColumn).


Administrator [Syncfusion]
Replied On March 28, 2008 05:15 PM UTC

Hi Sergey,

The GridDataBoundGrid uses the sorting support from the DataView associated with the DataSource. To do a custom sort through the DataView, the object in the column should implement IComparable. When this is done, the DataView will use theIComparable implementation when it tries to sort that column. Here is a forum thread with a sample.

Here is another way to do this that is more involved than just implementing IComparable on a derived object, but it does allow you to sort things with out deriving an object. It does away with teh grid depending upon the DataView.Sort support. This way you can sort columns and not see them move around as you edit entries. You only have to have an IComparer that you can use. You can also use this technique to sort unbound columns.

Please refer the below sample to implement this.

This sample consist of two GridDataBoundControl.First one is normal and next grid
was design for custom control using IComparer.



Please let me know with detailed explanation about your issue if you need further assistance for this.

Best regards,


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