case insensitive column sort for datagrid control

1

1001001001

Hi,



I am sorting a data grid column using the following code:

DataView vw = (DataView)this.DataSource;
string sort = vw.Table.Columns[col].ColumnName + " ASC";



It works fine but i would like to make it case insensitive so cap "A" and
lower "a" appear grouped together.



Any ideas how to do this?



Thanks
 
D

Damon Payne

This might be a little more work than you were hoping:
Implement your own comparator that is able to call ToUpper on string
fields so case doesn't matter. Set the comparator up so that you pass
it the name of the property you wish to sort on. Add your rows to an
ArrayList and call Sort( your comparor here). Does this make sense?
 
I

Ilya Tumanov [MS]

I believe it is case insensitive by default and 'A' should be grouped with
'a'.

If that's not the case, you can tweak DataTable.CaseSensitive property.


Best regards,


Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top