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
close icon

Sort GridList

Hi, How can I sort a column in a gridlist by clicking it''s header ? Thanks, Jose Melo

2 Replies

AD Administrator Syncfusion Team November 29, 2004 11:54 AM UTC

This will take a little coding to get done as the GridListControl has no built-in support for sorting. You would have to subscribe to the gridListControl1.Grid.CellClick event. In your handler, you would have to sort the values in the DataSource. There is no concept of sorting the grid iteself as teh grid just displays what is in teh DataSource in the order that it is within the datasource. So, to sort things, you would sort the DataSource. If you DataSource is a Datatable, you could use the dataTable.DefaultView.Sort property to sort the column. If it is an ArrayList, you can use the arrayList.Sort method to sort things. As far as catching the CellClick event and managing the sorting, you can see a sample that does something similar in Grid\Sample\QuickStart\GridControlSort sample. Getting a sort icon in the header will require you to handle the embedded grid''s QueryCellInfo, and set the e.Style.CellType property there.


AD Administrator Syncfusion Team November 29, 2004 01:08 PM UTC

Hi, That is something i have done in the past, here''s a sample. It also has a multi sort feature if you hold down the Control key. Colin sortgridlist_6814.zip

Loader.
Live Chat Icon For mobile
Up arrow icon