Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Unusual sort in datagrid

Thread Tools

Unusual sort in datagrid

Jim Nugent
Posts: n/a
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
"Remember, an amateur built the Ark; professionals built the Titanic."

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: When will Thunderbird support sort in place (in context sort)? Ron Natalie Firefox 0 02-02-2006 04:38 AM
The Colourised Bewitched -- sort of OK....... sort of! anthony DVD Video 26 06-28-2005 04:39 AM
DataGrid. How to keep the right keyfield value when Sort the DataGrid? Eugene ASP .Net 0 09-28-2004 05:15 PM
xsl:sort lang="es" modern vs. tradidional Spanish sort order nobody XML 0 06-01-2004 06:25 AM
Ado sort error-Ado Sort -Relate, Compute By, or Sort operations cannot be done on column(s) whose key length is unknown or exceeds 10 KB. Navin ASP General 1 09-09-2003 07:16 AM