Link to home
Start Free TrialLog in
Avatar of Arikael
ArikaelFlag for Switzerland

asked on

intercept sorting of a databound datagridview

Hi experts

I have a databound datagridview which can be sorted (columnheader click)
But everytime the dvg respectively the bindingsource behind it gets sorted because a user clicked on a columnhead, the dvg should first be sorted by a field I defined (always) and then by the field the user wants.

How can I achieve this?
is it possible to intercept the sorting and prefix the sort-string with my field?

I'm using c#, .NET 2.0 and WinForms
Avatar of Arikael
Arikael
Flag of Switzerland image

ASKER

Anybody?
Avatar of BalkisBr
BalkisBr

You're trying to sort a gridview with two columns rigth?

You can pass, on your sort expression, two or more columns separated by commas, like this:
"Col1 ASC, Col2 DESC"

If  it doesn't solve your problens, you can post your Sorting event code and i'll try to help you.
Avatar of Arikael

ASKER

Hi

a datagridview.

with sorting event, you mean the SortCompare event?
ASKER CERTIFIED SOLUTION
Avatar of BalkisBr
BalkisBr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Arikael

ASKER

thanks