Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > DataGrid Sorting - bidirectional

Reply
Thread Tools

DataGrid Sorting - bidirectional

 
 
Snig
Guest
Posts: n/a
 
      11-27-2003
Hi,

I want to sort the DataGrid according to the number of clicks of mouse on
the column-header link.
e.g.
if user clicks on the header once - it will be sorted ASC
if the header is double-clicked - it will be sorted DESC

It is not exactly toggling the sorting-order. I have seen a lot of messages
and articles in the web about toggling the sort order (like first time click
will generate ASC sort, next time click will generate DESC sort and so on).

But my requirement is how to catch single/double-click of the mouse on the
column header and fixing the sort order accordingly.

Any ideas ?

Thanx
Snig.


 
Reply With Quote
 
 
 
 
[ MVP ] Sukesh Ashok Kumar
Guest
Posts: n/a
 
      01-03-2004
If you are looking for client side sorting of data in datagrid, check the
example from
http://www.v4cnet.com/

Rgds
Sukesh

"Snig" <(E-Mail Removed)> wrote in message
news:eT3Yn$(E-Mail Removed)...
> Hi,
>
> I want to sort the DataGrid according to the number of clicks of mouse on
> the column-header link.
> e.g.
> if user clicks on the header once - it will be sorted ASC
> if the header is double-clicked - it will be sorted DESC
>
> It is not exactly toggling the sorting-order. I have seen a lot of

messages
> and articles in the web about toggling the sort order (like first time

click
> will generate ASC sort, next time click will generate DESC sort and so

on).
>
> But my requirement is how to catch single/double-click of the mouse on the
> column header and fixing the sort order accordingly.
>
> Any ideas ?
>
> Thanx
> Snig.
>
>



 
Reply With Quote
 
 
 
 
Prodip Saha
Guest
Posts: n/a
 
      01-05-2004
Very simple:
Add a private variable on the page/class:
private static string SortExpression="";

In your sortcommand event handler add the following codes:

if(SortExpression==e.SortExpression.ToString()) //Change the sort order to
DESC

{

SortExpression = e.SortExpression.ToString() +" DESC";

}

else //Change the sort order to ASC

{

SortExpression = e.SortExpression.ToString();

}

try

{

//Bind the Grid Data

BindGridData();


}

catch(Exception ex)

{

throw ex;

}

Prodip Saha

"[ MVP ] Sukesh Ashok Kumar" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> If you are looking for client side sorting of data in datagrid, check the
> example from
> http://www.v4cnet.com/
>
> Rgds
> Sukesh
>
> "Snig" <(E-Mail Removed)> wrote in message
> news:eT3Yn$(E-Mail Removed)...
> > Hi,
> >
> > I want to sort the DataGrid according to the number of clicks of mouse

on
> > the column-header link.
> > e.g.
> > if user clicks on the header once - it will be sorted ASC
> > if the header is double-clicked - it will be sorted DESC
> >
> > It is not exactly toggling the sorting-order. I have seen a lot of

> messages
> > and articles in the web about toggling the sort order (like first time

> click
> > will generate ASC sort, next time click will generate DESC sort and so

> on).
> >
> > But my requirement is how to catch single/double-click of the mouse on

the
> > column header and fixing the sort order accordingly.
> >
> > Any ideas ?
> >
> > Thanx
> > Snig.
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
bidirectional connection between two bidirectional ports Manfred Balik VHDL 12 09-10-2006 08:53 PM
datagrid bidirectional sorting mark ASP .Net 4 06-15-2004 06:06 PM
BiDirectional Sorting Sean ASP .Net Datagrid Control 2 02-10-2004 02:31 PM
DataGrid Sorting - bidirectional Snig ASP .Net 2 11-27-2003 05:44 PM
Re: A component for bidirectional sorting of a datagrid? John Saunders ASP .Net 1 08-12-2003 07:31 AM



Advertisments