sort not working correctly

Discussion in 'ASP .Net' started by =?Utf-8?B?SUdvdFlvdXJEb3ROZXQ=?=, Aug 18, 2004.

  1. I'm trying to sort my grid and its working halfway, I can only sort the grid
    once and it puts everything in ASC order (1234555666) and i can't sort it
    again to display as DESC order (6665554321),

    what could be causing this?
     
    =?Utf-8?B?SUdvdFlvdXJEb3ROZXQ=?=, Aug 18, 2004
    #1
    1. Advertising

  2. =?Utf-8?B?SUdvdFlvdXJEb3ROZXQ=?=

    Oytun YILMAZ Guest

    On Wed, 18 Aug 2004 05:59:01 -0700, IGotYourDotNet wrote:

    > I'm trying to sort my grid and its working halfway, I can only sort the grid
    > once and it puts everything in ASC order (1234555666) and i can't sort it
    > again to display as DESC order (6665554321),
    >
    > what could be causing this?


    Did you switch your sorting expression like below ?

    "ColumnFOO" - "ColumnFOO Desc"

    If you could post your grd_SortCommand I could help more

    - Oytun YILMAZ
     
    Oytun YILMAZ, Aug 18, 2004
    #2
    1. Advertising

  3. =?Utf-8?B?SUdvdFlvdXJEb3ROZXQ=?=

    tribal Guest

    the stored procedure needs to do the asc and desc

    select *
    from emp e
    order by @column_name // pass the column name to sort
    asc

    you can then return the sorted result

    hope this helps

    >-----Original Message-----
    >I'm only doing
    >sub datagrid1_sortcommand()
    >bindGrid(e.sortExpression)
    >end sub
    >
    >the bindGird calls Stored Procedures to bind the datagrid
    >
    >Its sorts the grid, sort of, i need in asc and desc when

    I click the column.
    >
    >
    >
    >
    >
    >"Oytun YILMAZ" wrote:
    >
    >> On Wed, 18 Aug 2004 05:59:01 -0700, IGotYourDotNet

    wrote:
    >>
    >> > I'm trying to sort my grid and its working halfway,

    I can only sort the grid
    >> > once and it puts everything in ASC order

    (1234555666) and i can't sort it
    >> > again to display as DESC order (6665554321),
    >> >
    >> > what could be causing this?

    >>
    >> Did you switch your sorting expression like below ?
    >>
    >> "ColumnFOO" - "ColumnFOO Desc"
    >>
    >> If you could post your grd_SortCommand I could help

    more
    >>
    >> - Oytun YILMAZ
    >>

    >.
    >
     
    tribal, Aug 18, 2004
    #3
  4. =?Utf-8?B?SUdvdFlvdXJEb3ROZXQ=?=

    Oytun YILMAZ Guest

    On Wed, 18 Aug 2004 06:19:09 -0700, IGotYourDotNet wrote:

    > I'm only doing
    > sub datagrid1_sortcommand()
    > bindGrid(e.sortExpression)
    > end sub
    >
    > the bindGird calls Stored Procedures to bind the datagrid
    >
    > Its sorts the grid, sort of, i need in asc and desc when I click the column.
    >
    >
    >
    >
    >
    > "Oytun YILMAZ" wrote:
    >
    >> On Wed, 18 Aug 2004 05:59:01 -0700, IGotYourDotNet wrote:
    >>
    >>> I'm trying to sort my grid and its working halfway, I can only sort the grid
    >>> once and it puts everything in ASC order (1234555666) and i can't sort it
    >>> again to display as DESC order (6665554321),
    >>>
    >>> what could be causing this?

    >>
    >> Did you switch your sorting expression like below ?
    >>
    >> "ColumnFOO" - "ColumnFOO Desc"
    >>
    >> If you could post your grd_SortCommand I could help more
    >>
    >> - Oytun YILMAZ
    >>


    if your column name is FOO then you always call bindGird("FOO") You should
    change your bindfunction place another parameter and a viewstate to keep
    your last sort order like this:

    sub datagrid1_sortcommand()
    if viewstate("LastSort")="ASC"
    bindGrid(e.sortExpression,"DESC")
    viewstate("LastSort")="DESC"
    elseif viewstate("LastSort")="DESC"
    bindGrid(e.sortExpression,"ASC")
    viewstate("LastSort")="ASC"
    end sub
     
    Oytun YILMAZ, Aug 18, 2004
    #4
  5. so i would have to create a new SP to allow for this?
    The SP currenty returns the data in DESC order.

    when i sort it, it makes the columns in ASC order which is fine, but if i
    try and sort it again for DESC order nothing happens. So does the SP need to
    allow this in it as a input or no?

    "tribal" wrote:

    >
    > the stored procedure needs to do the asc and desc
    >
    > select *
    > from emp e
    > order by @column_name // pass the column name to sort
    > asc
    >
    > you can then return the sorted result
    >
    > hope this helps
    >
    > >-----Original Message-----
    > >I'm only doing
    > >sub datagrid1_sortcommand()
    > >bindGrid(e.sortExpression)
    > >end sub
    > >
    > >the bindGird calls Stored Procedures to bind the datagrid
    > >
    > >Its sorts the grid, sort of, i need in asc and desc when

    > I click the column.
    > >
    > >
    > >
    > >
    > >
    > >"Oytun YILMAZ" wrote:
    > >
    > >> On Wed, 18 Aug 2004 05:59:01 -0700, IGotYourDotNet

    > wrote:
    > >>
    > >> > I'm trying to sort my grid and its working halfway,

    > I can only sort the grid
    > >> > once and it puts everything in ASC order

    > (1234555666) and i can't sort it
    > >> > again to display as DESC order (6665554321),
    > >> >
    > >> > what could be causing this?
    > >>
    > >> Did you switch your sorting expression like below ?
    > >>
    > >> "ColumnFOO" - "ColumnFOO Desc"
    > >>
    > >> If you could post your grd_SortCommand I could help

    > more
    > >>
    > >> - Oytun YILMAZ
    > >>

    > >.
    > >

    >
     
    =?Utf-8?B?SUdvdFlvdXJEb3ROZXQ=?=, Aug 18, 2004
    #5
    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. Hermit Dave

    Re: dropdownlist box not working correctly

    Hermit Dave, Sep 2, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    414
    Hermit Dave
    Sep 2, 2004
  2. Stuart Palmer

    History not working correctly

    Stuart Palmer, Jun 2, 2004, in forum: HTML
    Replies:
    0
    Views:
    382
    Stuart Palmer
    Jun 2, 2004
  3. Rolf Kemper
    Replies:
    1
    Views:
    410
    David Carlisle
    Jan 21, 2005
  4. rosemm
    Replies:
    2
    Views:
    792
    Martin Honnen
    Apr 5, 2005
  5. Navin
    Replies:
    1
    Views:
    699
    Ken Schaefer
    Sep 9, 2003
Loading...

Share This Page