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 of Gridcontrol

Thread ID:

Created:

Updated:

Platform:

Replies:

58938 Apr 1,2007 12:57 PM Apr 2,2007 03:50 PM Windows Forms 1
loading
Tags: GridControl
Rahul Hans
Asked On April 1, 2007 12:57 PM

Hi Guys

Thanks a lot for your help with previous issues. A lot of issues have been resolved.

We are preparing a Voucher Data Entry Program and are using the unbound Gridcontrol.

We have defined 19 rows and 5 columns. We wish to sort the grid programmmatically (not thru the user clicking on the column header) when the user has reached the final right most column and moves on to the next row. We plan on doing this in CurrentCellDeactivating event which we are already using for validation(s).

Our requirements are as follows

1. we wish to sort the first 15 rows only.

2. The soring should be done based on what the user has selected thru a combobox in the first column of every row.

Is there any way we can define a range and sort that range only ? (Just thinking out aloud)...

Do we have to implement Icomparer Interface ?

Thanks & Best Regards in Advance


Saravanan A [Syncfusion]
Replied On April 2, 2007 03:50 PM

Hi RH,

You can sort the grid column programatically by using gridControl1.Data.SortByColumn method. For this you can use the CurrentCellActivated event. Here you can check whether the current cell is moving from the last column by using CurrentCell.MoveFromColIndex property.

To prevent some rows being sorted, remove those rows from the grid and the insert it back after sorting.
To sort the combobox column with the display member you need to implement the IComparer interface.
For implementation, please refer to this sample.

Regards,
Saravanan

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.

;