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
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