sorting issue

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mike

    sorting issue

    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?


  • Mark Rae [MVP]

    #2
    Re: sorting issue

    "Mike" <Mike@yahoo.com wrote in message
    news:uILCqKFVIH A.2368@TK2MSFTN GP05.phx.gbl...
    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


    Comment

    • Mike

      #3
      Re: sorting issue

      We're doing the sorting within the datagrid_sortin g() 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]" <mark@markNOSPA Mrae.netwrote in message
      news:OL82kQFVIH A.6060@TK2MSFTN GP05.phx.gbl...
      "Mike" <Mike@yahoo.com wrote in message
      news:uILCqKFVIH A.2368@TK2MSFTN GP05.phx.gbl...
      >
      >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

      Comment

      • Mark Rae [MVP]

        #4
        Re: sorting issue

        "Mike" <Mike@yahoo.com wrote in message
        news:%23pIVFTFV IHA.5264@TK2MSF TNGP02.phx.gbl. ..
        >How are you doing the sorting?
        >
        We're doing the sorting within the datagrid_sortin g() 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


        Comment

        • Mike

          #5
          Re: sorting issue

          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]" <mark@markNOSPA Mrae.netwrote in message
          news:OXcGcWFVIH A.3364@TK2MSFTN GP03.phx.gbl...
          "Mike" <Mike@yahoo.com wrote in message
          news:%23pIVFTFV IHA.5264@TK2MSF TNGP02.phx.gbl. ..
          >
          >>How are you doing the sorting?
          >>
          >We're doing the sorting within the datagrid_sortin g() 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

          Comment

          • Mark Rae [MVP]

            #6
            Re: sorting issue

            "Mike" <Mike@yahoo.com wrote in message
            news:eMyL$aFVIH A.536@TK2MSFTNG P06.phx.gbl...
            "Mark Rae [MVP]" <mark@markNOSPA Mrae.netwrote in message
            news:OXcGcWFVIH A.3364@TK2MSFTN GP03.phx.gbl...
            >"Mike" <Mike@yahoo.com wrote in message
            >news:%23pIVFTF VIHA.5264@TK2MS FTNGP02.phx.gbl ...
            >>
            >>>How are you doing the sorting?
            >>>
            >>We're doing the sorting within the datagrid_sortin g() 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


            Comment

            Working...