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

Sorting the part of grid

Thread ID:





57901 Mar 13,2007 07:19 PM UTC Mar 15,2007 04:08 PM UTC WinForms 4
Tags: GridControl
Andrey Gruber
Asked On March 13, 2007 07:19 PM UTC

Is there any way to sort only the part of grid, and not entire grid? That is, if I have grid that looks like:

number | month
10 | october
7 | july
11 | november
5 | may
9 | september

I want to sort the months starting from third row, leaving october and july rows unsorted.
Sorry for ugly example :)
We use Essential studio and VS.NET 1.1

Administrator [Syncfusion]
Replied On March 13, 2007 09:08 PM UTC

Hi Andrey,

The attached sample implements the ListWrapper class to freeze the rows from sorting in a grid. It also support the multicolumn sorting in a grid. Please try this and let me know if this helps.


//set either a Datatable or IList as datasource with FreezeRows
private void SetDataSource(object dataSource)
ListWrapper lw = this.gridDataBoundGrid1.DataSource as ListWrapper;
if(lw != null)
lw = dataSource is DataTable ? new ListWrapper((DataTable)dataSource) : new ListWrapper((IList)dataSource);
this.gridDataBoundGrid1.DataSource = lw;
lw.WireGrid(gridDataBoundGrid1); // to tie in the UI

//just for timing purposes
lw.SortStarting += new EventHandler(lw_SortStarting);
lw.SortCompleted += new EventHandler(lw_SortCompleted);

//Freeze the rows from Sorting.....
lw.FreezeSortingStartIndex = 0;
lw.FreezeSortingEndIndex = 5;

Please refer this.

Best regards,

Andrey Gruber
Replied On March 14, 2007 05:41 PM UTC

Thanks, Haneef, for reply!
Unfortunately, we use the simple grid, not data bound - I was sure it supports sorting as well, but it does not :(
I'll try something else, may be temporarily storage the data in array with subsequent sorting an replacing the existing one.
Thank you.

Administrator [Syncfusion]
Replied On March 14, 2007 07:21 PM UTC

Hi Andrey,

Here is a modified sample that shows you "How to freeze the rows on sorting in a simple gridcontrol?". Please try the sample and let me know if this helps.
Click here to find GridControlSort sample

Best regards,

Andrey Gruber
Replied On March 15, 2007 04:08 PM UTC

Hi, Haneef!
It works! Thank you very much!


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