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 GridList

Thread ID:





21917 Nov 29,2004 10:07 AM UTC Nov 29,2004 01:08 PM UTC WinForms 2
Tags: GridControl
Jose Luis Melo
Asked On November 29, 2004 10:07 AM UTC

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

Administrator [Syncfusion]
Replied On 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.

Administrator [Syncfusion]
Replied On 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


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