sort not working correctly

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

Oytun YILMAZ

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
 
T

tribal

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.





 
O

Oytun YILMAZ

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
 
G

Guest

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.
 

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

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top