views:

10

answers:

1

Hi everyone!

Im currently trying to fix some bugs in a system using C# in VS 2008.

The problem goes as follows:

The client wants some controls to be sorted. The form consists of four controls. Two of which are binded with BindingSourceA lets say and the other two with BindingSourceB. One of the controls binded with BindingSourceA displays a code and the other one a name. Same goes for BindingSourceB. Control1 needs to be sorted using the Code display member/column while Control2 needs to be sorted using the Name display member/column. Same goes for controls 3 and 4. After some poking around i found that BindingSourceA.Sort = "Code ASC and BindingSourceB.Sort = "Code ASC do the job. BUT i need something along the lines of BindingSourceA.Sort = "Code ASC, Name ASC" which also was the result of my poking around. The problem is that it doesnt do the trick for me.. Its either one or the other. I even tried BindingSourceA.Sort = "Code ASC"; BindingSourceA.Sort = "Name ASC"; but that didnt work either..

Let me know if you need anymore info.

Thanks in advance

A: 

The sorting support of data-bindings actually depends entirely on the underlying data implementation, and whether it supports IBindingList.SupportsSorting, IBindingListView.SupportsAdvancedSorting, neither, or both. Personally: just sort the data separately (via LINQ, perhaps), and then data-bind it. Avoids the entire issue and works for any data source.

Marc Gravell