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.

Sorting the part of grid

Thread ID:

Created:

Updated:

Platform:

Replies:

57901 Mar 13,2007 03:19 PM Mar 15,2007 12:08 PM Windows Forms 4
loading
Tags: GridControl
Andrey Gruber
Asked On March 13, 2007 03:19 PM

Hi!
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 3.3.0.0 and VS.NET 1.1

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

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.

[C#]

//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.UnWireGrid(this.gridDataBoundGrid1);
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.
http://websamples.syncfusion.com/samples/Grid.Windows/FreezeRowsFromSortinggdbg/main.htm

Best regards,
Haneef

Andrey Gruber
Replied On March 14, 2007 01:41 PM

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 03:21 PM

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,
Haneef

Andrey Gruber
Replied On March 15, 2007 12:08 PM

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

CONFIRMATION

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.

;