sorting issue

Discussion in 'ASP .Net' started by Mike, Jan 11, 2008.

  1. Mike

    Mike Guest

    I have several datagirds that allow sorting on two date columns. The sorting
    works but its not showing the newest date first when I sort. For example

    if I have dates in my column as

    01/01/2008
    12/01/2007
    12/08/2007
    02/02/2007


    when I sort, I get it like
    12/08/2007
    12/01/2007
    02/02/2007
    01/01/2008


    or like this:
    01/01/2008
    02/02/2007
    12/08/2007
    12/01/2007

    what could be causing the sort to work as such? If I don't have a date such
    as 01/01/2008, the sorting works correclty, its when the date is 01/01/2008
    that its not sorting correctly. Any ideas on what may be causing this?
     
    Mike, Jan 11, 2008
    #1
    1. Advertising

  2. "Mike" <> wrote in message
    news:...

    > what could be causing the sort to work as such?


    It's treating the date columns as pieces of text... This would be expected
    behaviour if you are doing the sorting client-side, because it won't know
    natively that the data to be sorted is a textual representation of a date
    type...

    How have you configured your DataGrid(s), specifically the column(s) in
    question?

    How are you doing the sorting?


    --
    Mark Rae
    ASP.NET MVP
    http://www.markrae.net
     
    Mark Rae [MVP], Jan 11, 2008
    #2
    1. Advertising

  3. Mike

    Mike Guest

    We're doing the sorting within the datagrid_sorting() method in the code
    behind. The sorting has been working correctly, its just now with the
    01/01/2008 dates in there, its not sorting correctly




    "Mark Rae [MVP]" <> wrote in message
    news:...
    > "Mike" <> wrote in message
    > news:...
    >
    >> what could be causing the sort to work as such?

    >
    > It's treating the date columns as pieces of text... This would be expected
    > behaviour if you are doing the sorting client-side, because it won't know
    > natively that the data to be sorted is a textual representation of a date
    > type...
    >
    > How have you configured your DataGrid(s), specifically the column(s) in
    > question?
    >
    > How are you doing the sorting?
    >
    >
    > --
    > Mark Rae
    > ASP.NET MVP
    > http://www.markrae.net
     
    Mike, Jan 11, 2008
    #3
  4. "Mike" <> wrote in message
    news:%...

    >> How are you doing the sorting?

    >
    > We're doing the sorting within the datagrid_sorting() method in the code
    > behind.


    Please post your code...

    > The sorting has been working correctly, its just now with the 01/01/2008
    > dates in there, its not sorting correctly


    Almost certainly just a coincidence...


    --
    Mark Rae
    ASP.NET MVP
    http://www.markrae.net
     
    Mark Rae [MVP], Jan 11, 2008
    #4
  5. Mike

    Mike Guest

    I found it, the developer that created the stored procedures is passing all
    the dates as text fields and not date fields.
    I fixed it now.
    "Mark Rae [MVP]" <> wrote in message
    news:...
    > "Mike" <> wrote in message
    > news:%...
    >
    >>> How are you doing the sorting?

    >>
    >> We're doing the sorting within the datagrid_sorting() method in the code
    >> behind.

    >
    > Please post your code...
    >
    >> The sorting has been working correctly, its just now with the 01/01/2008
    >> dates in there, its not sorting correctly

    >
    > Almost certainly just a coincidence...
    >
    >
    > --
    > Mark Rae
    > ASP.NET MVP
    > http://www.markrae.net
     
    Mike, Jan 11, 2008
    #5
  6. "Mike" <> wrote in message
    news:eMyL$...

    > "Mark Rae [MVP]" <> wrote in message
    > news:...
    >> "Mike" <> wrote in message
    >> news:%...
    >>
    >>>> How are you doing the sorting?
    >>>
    >>> We're doing the sorting within the datagrid_sorting() method in the code
    >>> behind.

    >>
    >> Please post your code...
    >>
    >>> The sorting has been working correctly, its just now with the 01/01/2008
    >>> dates in there, its not sorting correctly

    >>
    >> Almost certainly just a coincidence...

    >
    > I found it, the developer that created the stored procedures is passing
    > all the dates as text fields and not date fields.


    Aha... :)


    --
    Mark Rae
    ASP.NET MVP
    http://www.markrae.net
     
    Mark Rae [MVP], Jan 11, 2008
    #6
    1. Advertising

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. Jordo
    Replies:
    0
    Views:
    470
    Jordo
    Oct 31, 2003
  2. Replies:
    2
    Views:
    1,490
    James Kanze
    Jul 6, 2010
  3. Jason
    Replies:
    0
    Views:
    412
    Jason
    Oct 4, 2006
  4. Tom Kirchner

    sorting by multiple criterias (sub-sorting)

    Tom Kirchner, Oct 11, 2003, in forum: Perl Misc
    Replies:
    3
    Views:
    513
    Michael Budash
    Oct 11, 2003
  5. Íéêüëáïò Êïýñáò

    Sorting a set works, sorting a dictionary fails ?

    Íéêüëáïò Êïýñáò, Jun 10, 2013, in forum: Python
    Replies:
    12
    Views:
    170
    Ulrich Eckhardt
    Jun 10, 2013
Loading...

Share This Page