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

GridControl Sorting

Hi, everyone

I'd like to know, if there any way to sort rows in GridControl.

My question is if there is a way to sort GridControl based on values of specific column.

If there is no way how can I sort GridControl based on values of specific column using CellClick efficiently?

Something which will be similiar to:

Private Sub grdNew_CellClick(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Grid.GridCellClickEventArgs) Handles grdNew.CellClick
Select Case e.ColIndex
Case 1

Case 2

End Select
End Sub

Regards, and have a nice day :)
Allon


P.S

I don't use data binding. I add rows programmatically.

1 Reply

LS Lingaraj S Syncfusion Team September 24, 2009 11:05 AM UTC

Hi Allon,

Thank you for your interest in Syncfusion products.

There is no built-in support for sorting rows. But it can be achieved by Custom IComparer's.

Refer the sample from below link to sort a rows:
http://files.syncfusion.com/support/samples/Grid.Windows/Forums/SortRows.zip

Also the GridControl does not have default property to sort the columns with column header. However It can be achieved with Data.SortByColumn method in GridControl. In that method the IComparer object is used to sort the data's in GridControl.

Refer the sample in below link, it demonstrate the Sorting in GridControl.
http://files.syncfusion.com/support/samples/Grid.Windows/7.2.0.37/I57184/GridSort.zip

Refer a another sample in below link, it demonstrate the MutipleColumnSorting in GridControl.
http://files.syncfusion.com/support/samples/Grid.Windows/7.1.0.30/I56819/main1.htm

Please let me know if you have any queries.

Regards,
Lingaraj S.

Loader.
Live Chat Icon For mobile
Up arrow icon