Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Re: alpha numeric sorting for dataview

Thread Tools

Re: alpha numeric sorting for dataview

John Saunders
Posts: n/a
"caldera" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
I have values which are numeric and string values. lets say 1,2 ,3 and like xc1,xc2 . I want to sort these values. First sorting numeric ones than none numeric ones. How can I do this with dataview or dataset
Thanks too much.
I don't believe it's possible to create your own sort order for a DataView or DataSet.

If you can get the information into an Array, you can write your own IComparer to use in Array.Sort. In fact, you could create yourself an array of pairs (rowIndex, key). You could then sort the array on the key using your custom IComparer implementation. You could then create a new DataTable by running through the sorted array, picking up the original row (by the rowIndex), and adding it to the new table. This new table would then be in the correct order.
John Saunders
johnwsaundersiii at hotmail

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
Sorted DataView, but unsorted datalist when bound to the dataview CodeMonkey ASP .Net 1 02-04-2011 10:55 AM
check if string contains only alpha numeric characters Java 5 08-19-2008 10:24 AM
How to Force Alpha-Numeric Passwords to increase network security? Cisco 0 01-09-2007 10:52 AM
declaring alpha numeric shan C Programming 11 11-17-2005 08:06 AM
DataGrid-DataView-XML-Sorting strings as numeric Joe Rattz ASP .Net Datagrid Control 2 11-20-2003 09:51 PM