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.
Unfortunately, activation email could not send to your email. Please try again.

Sort GridList

Thread ID:





21917 Nov 29,2004 05:07 AM Nov 29,2004 08:08 AM Windows Forms 2
Tags: GridControl
Jose Luis Melo
Asked On November 29, 2004 05:07 AM

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 06:54 AM

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 08:08 AM

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.

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.