custom sorting

Discussion in 'ASP .Net Datagrid Control' started by Paul W, Apr 18, 2005.

  1. Paul W

    Paul W Guest

    Hi,
    I have a datagrid that I build using data returned from a SP. But I
    populate the datagrid using a dataview. In this dataview, I populate one of
    the columns with a string that is basically an html link. The display text
    is always numeric. For instance, the column will display 7, but the value
    is something like "<a href='myData.aspx?id=" + reader["MyNumber"].ToString()
    + "'>" + reader["IMyNumber"].ToString() + "</a>";
    The problem I am having is that I want to sort the column like it is
    numeric. But it is sorting it like a string (which makes sense, but it is
    not what I want). So if I have numbers like 1, 2, 3, 11....it will display
    as 1, 11, 2, 3 for the sort. I want it to display 1, 2, 3, 11. Is this
    even possible? If so, can someone guide me (or give me code) in the right
    direction? Thanks
    Paul
     
    Paul W, Apr 18, 2005
    #1
    1. Advertisements

  2. Paul W

    dinil Guest

    i guess wht u can do is to add a new column with integer type and copy all
    the values there and sort by that column.
     
    dinil, Apr 19, 2005
    #2
    1. Advertisements

  3. Paul W

    Paul W Guest

    great idea! i did not think about that. thank you.
     
    Paul W, Apr 19, 2005
    #3
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.