sort not working correctly

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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
 
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.





 
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.

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
 
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 said:
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.
 
Back
Top