473,667 Members | 2,568 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

sort not working correctly

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?

Nov 18 '05 #1
4 1280
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
Nov 18 '05 #2

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_sortc ommand()
bindGrid(e.sor tExpression)
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

.

Nov 18 '05 #3
On Wed, 18 Aug 2004 06:19:09 -0700, IGotYourDotNet wrote:
I'm only doing
sub datagrid1_sortc ommand()
bindGrid(e.sort Expression)
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_sortc ommand()
if viewstate("Last Sort")="ASC"
bindGrid(e.sort Expression,"DES C")
viewstate("Last Sort")="DESC"
elseif viewstate("Last Sort")="DESC"
bindGrid(e.sort Expression,"ASC ")
viewstate("Last Sort")="ASC"
end sub
Nov 18 '05 #4
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_sortc ommand()
bindGrid(e.sor tExpression)
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

.

Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2439
by: Bruce Pullum | last post by:
I have a datagrid that I am using a DataView with. All works great for the sorting of the columns. However, after I sort the column, and then try and select a data row to edit, the row selected represents the indes of the actual DataGrid and not the DataView. For example.. Lets say I have 4 rows of data.. In the 4 rows I have an Appt Num of 1,2,3,4... Each representing a data row... I sort DESC so the rows display 4,3,2,1... If I...
11
3884
by: James P. | last post by:
Hello, I have a report with the Priority field is used as sort order and grouping. The problem is the data in this Priority field if sorted in ascending order is: High, Low, and Medium. How could I sort it as: Low, Medium, High? Any suggestion is greatly appreciated, James
4
5130
by: Nhmiller | last post by:
This is directly from Access' Help: "About designing a query When you open a query in Design view, or open a form, report, or datasheet and show the Advanced Filter/Sort window (Advanced Filter/Sort window: A window in which you can create a filter from scratch. You enter criteria expressions in the filter design grid to restrict the records in the open form or datasheet to a subset of records that meet the criteria.), you see the design...
4
2162
by: DancnDude | last post by:
I have a class that needs to have several different kinds of sorting routines on an ArrayList that it needs to conditionally do based upon the data. I have successfully created a class that implements IComparer and does the sort correctly for one of these sort types. This class's definition is like: // Sort class that implements IComparer so public class CompareFields1 : IComparer { public int Compare(object a, object b)
5
2879
by: Ingo Brueckl | last post by:
I need to declare a fixed array of (already defined and working) sort functions (sortfunc1, sortfunc2, sortfunc3) to pass one element of the array to qsort itself: int index; ??? func = {sortfunc1, sortfunc2, sortfunc3}; index = /* calculated somehow */; qsort(what, what_elements, sizeof(what_element), func);
1
4123
by: aarklon | last post by:
Hi folks, this is the program implementing quicksort #include<stdio.h> #include<stdlib.h> #define swap(a,b){int t; t=a;a=b;b=t;} int partition(int,int,int); void quicksort(int,int,int);
1
3554
by: Smokey Grindle | last post by:
does anyone know of a good example of asp.net 2.0's gridview showing a sort order arrow in the column header correctly and working? I cant seem to get what ive found on google to work (see previous post called (sort expression always = "" in gridview on 6/28/2006)... any help would be great.. thanks!
0
4816
by: rmgalante | last post by:
Hi, I've been experimenting with the ASP.Net GridView and encountered some interesting issues that I thought I would share. I have a page that loads a GridView with a generic collection of objects. For the purposes of this discussion, the objects define a Customer, and have an id and a name. I want to sort these customers by id or by name in ascending and descending order. Here is what I did to make it work.
4
1369
by: =?Utf-8?B?UmljaEI=?= | last post by:
Can someone confirm if my no spam alias is set up correctly to get answers to questions. I have been talking to the concierge for over a week to get an answer to a question. Each time I am told to update my no spam alias and wait 2 business days. I have paid for MSDN for the last 3 years and don't ask too many questions, infact I keep being told that the alias expired in May. I am getting really fed up with waiting 2 business days to...
0
8365
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8883
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8788
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8563
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8646
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4200
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2013
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.