Re: alpha numeric sorting for dataview

Discussion in 'ASP .Net' started by John Saunders, Jul 20, 2004.

  1. "caldera" <> wrote in message news:...
    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
     
    John Saunders, Jul 20, 2004
    #1
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. shan

    declaring alpha numeric

    shan, Nov 16, 2005, in forum: C Programming
    Replies:
    11
    Views:
    1,016
    Simon Biber
    Nov 17, 2005
  2. CodeMonkey
    Replies:
    1
    Views:
    783
    joyal jhaveri
    Feb 4, 2011
  3. Replies:
    5
    Views:
    6,705
    Daniele Futtorovic
    Aug 19, 2008
  4. Joe Rattz

    DataGrid-DataView-XML-Sorting strings as numeric

    Joe Rattz, Nov 19, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    255
    David Knipper
    Nov 20, 2003
  5. WB

    ResetPassword() to Alpha-numeric?

    WB, Jul 25, 2007, in forum: ASP .Net Security
    Replies:
    3
    Views:
    724
    Christopher Johnson
    Feb 22, 2010
Loading...

Share This Page