Unusual sort in datagrid

J

Jim Nugent

Hello,
I have a requirement to sort a column in a datagrid (bound to a dataview)
that may contain blanks. The data needs to be in ascending order with the
blanks at the end. Unfortunately, the standard sort algorithm thinks a blank
or null is "less than" anything else so they end up at the top.

I've thought of sorting, and then checking for blanks and stuffing them in
at the end until I hit a non-blank, but I'm not sure how to do this with a
dataset, and i'm not sure when the sorting actually occurs (probably NOT as
soon as dataView.Sort is set to an expression). Probably on DataBind().

I've also considered adding a hidden column in which blanks are replaced by
strings filled with the "heaviest" character (Z?) and sorting on that.

Can anyone think of anything more elegant?
Thanks in advance
 

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

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top