You will have a hard time. The problem is IBindingList. The native .NET
Datagrid uses that interface to tell the bound collection on which
column to sort. It then calls IBindingList.ApplySort(). This method
accepts a single property descriptor. 

In other words: you can't use the build in logic to sort on multiple
columns, as IBindingList doesn't suport that. The core of the problem is
that the grid itself doesn't do the sorting, the bound collection does
(by implementing IBindingList.ApplySort).

Grids who do support multi-column sorting do the sorting themselves and
do not rely on the implementation of IBindingList. (you can for example
sort ArrayLists in these grids, while you can't do that in the native
.NET grid as Arraylist doesn't implement IBindingList).

The only solution is thus:
- subclass the grid and grab column header click events
- apply the sorting yourself on the data bound to the grid.

        Frans.

> I need to override the default sorting of the Datagrid class. 
> I need to be able to sort according to more than one column, 
> i.e. have a primary,.secondary, tertiarty,..and  so on, e.g. 
> so that the DataView.Sort
> string can look like    " Col1 ASC,  Col2 DESC,....and so 
> on." It seems that
> the default sorting of the Datagrid class sets the Sort 
> property according to the latest column sorted,..in my case 
> the last column header clicked on.
> I need to locate the handler which does this and replace it 
> with my own logic for queing the sort requests so that " Col1 
> ASC,  Col2 DESC,.."
> results. I do not want to resort according to my policy after 
> it has perfomed its default sort, but replace its sorting altogether.
> 
> 
> Does anyone have an answer?
> 
> 
> Thanks
> Micah
> 
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com 
> Some .NET courses you may be interested in:
> 
> NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles 
> http://www.develop.com/courses/gaspdotnetls
> 
> View archives and manage your subscription(s) at 
> http://discuss.develop.com
> 
> 
> 

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to