|
 |
asp_web_howto thread: Complex Sorting
Message #1 by =?iso-8859-1?q?sky=20limit?= <skylimit7772002@y...> on Tue, 29 Oct 2002 11:02:46 +0000 (GMT)
|
|
Hi All,
This is little complicated for me and I can't understand how this can be done.
My problem is I get records from the database put it in the html table like..
Table heading
Name Age Rollno
Jon 27 1
Smith 28 2
Phil 34 3
.......
....... etc..
Now what I want if some user clicks on the table heading "Name" the records should be sorted name wise or clicks on heading "Age"
should be sorted age wise or "Rollno" should be sorted rollno wise.
I do know understand how to do this .
If anybody has got any sample or any help how to do this would be a real help.
Thanks for the help.
Regards
---------------------------------
Get a bigger mailbox -- choose a size that fits your needs.
Message #2 by johnc@w... on Tue, 29 Oct 2002 11:34:47
|
|
Hello,
ASPToday www.asptoday.com has a brilliant 2 part article by Chris Garret
that will solve your problem. The first part: "Classic ASP Data Grid"
(http://www.asptoday.com/content.asp?id=1485) shows you how to display,
paginate and sort your data. Part 2 (http://www.asptoday.com/content.asp?
id=1957) shows how to add, delete and edit the displayed rows.
John
John Richard Chapman
Chief Technical Editor
ASPToday
Wrox Press Ltd.
john@a...
http://www.asptoday.com/
http://www.csharptoday.com/
>
Hi All,
This is little complicated for me and I can't understand how this can be
done.
My problem is I get records from the database put it in the html table
like..
Table heading
Name Age Rollno
Jon 27 1
Smith 28 2
Phil 34 3
.......
....... etc..
Now what I want if some user clicks on the table heading "Name" the
records should be sorted name wise or clicks on heading "Age" should be
sorted age wise or "Rollno" should be sorted rollno wise.
I do know understand how to do this .
If anybody has got any sample or any help how to do this would be a real
help.
Thanks for the help.
Regards
---------------------------------
Get a bigger mailbox -- choose a size that fits your needs.
Message #3 by =?iso-8859-1?q?sky=20limit?= <skylimit7772002@y...> on Tue, 29 Oct 2002 11:39:19 +0000 (GMT)
|
|
Hi John,
Thanks for reply.
But I can't find any thing there. I just see links and links.
No code at all.
If u give me the proper direction.
Thanks
johnc@w... wrote:Hello,
ASPToday www.asptoday.com has a brilliant 2 part article by Chris Garret
that will solve your problem. The first part: "Classic ASP Data Grid"
(http://www.asptoday.com/content.asp?id=1485) shows you how to display,
paginate and sort your data. Part 2 (http://www.asptoday.com/content.asp?
id=1957) shows how to add, delete and edit the displayed rows.
John
John Richard Chapman
Chief Technical Editor
ASPToday
Wrox Press Ltd.
john@a...
http://www.asptoday.com/
http://www.csharptoday.com/
>
Hi All,
This is little complicated for me and I can't understand how this can be
done.
My problem is I get records from the database put it in the html table
like..
Table heading
Name Age Rollno
Jon 27 1
Smith 28 2
Phil 34 3
.......
....... etc..
Now what I want if some user clicks on the table heading "Name" the
records should be sorted name wise or clicks on heading "Age" should be
sorted age wise or "Rollno" should be sorted rollno wise.
I do know understand how to do this .
If anybody has got any sample or any help how to do this would be a real
help.
Thanks for the help.
Regards
---------------------------------
Get a bigger mailbox -- choose a size that fits your needs.
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
---------------------------------
Get a bigger mailbox -- choose a size that fits your needs.
Message #4 by "Ken Schaefer" <ken@a...> on Wed, 30 Oct 2002 11:56:49 +1100
|
|
You have to pay for it (see the text at the bottom of the screen).
That all said, what you want is relatively simple. You need to create links
for each column name. Pass a value when the user clicks on the link. The
value is used to determine the sort order of the recordset.
eg
<a href="results.asp?sort=name">Name</a>
<a href="results.asp?sort=age">Age</a>
<a href="results.asp?sort=rollno">RollNo</a>
and then later on:
<%
strOrderBy = Request.QueryString("sort")
Select Case strOrderBy
Case "name"
strSQL = "ORDER BY UserName"
Case "age"
strSQL = "ORDER BY Age"
Case "rollno"
strSQL = "ORDER BY RollNo"
Case Else
strSQL = "ORDER BY UserName"
End Select
' Now add the ORDER BY to the rest of the SQL statement
strSQL = "SELECT UserName, Age, RollNo FROM Users " & strSQL
Set objRS = objConn.Execute(strSQL)
%>
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "sky limit" <skylimit7772002@y...>
Subject: [asp_web_howto] Re: Complex Sorting
:
: Hi John,
: Thanks for reply.
: But I can't find any thing there. I just see links and links.
: No code at all.
: If u give me the proper direction.
: Thanks
:
:
:
:
:
:
:
:
:
:
: johnc@w... wrote:Hello,
:
: ASPToday www.asptoday.com has a brilliant 2 part article by Chris Garret
: that will solve your problem. The first part: "Classic ASP Data Grid"
: (http://www.asptoday.com/content.asp?id=1485) shows you how to display,
: paginate and sort your data. Part 2 (http://www.asptoday.com/content.asp?
: id=1957) shows how to add, delete and edit the displayed rows.
:
: John
:
: John Richard Chapman
: Chief Technical Editor
: ASPToday
: Wrox Press Ltd.
: john@a...
: http://www.asptoday.com/
: http://www.csharptoday.com/
:
: >
: Hi All,
:
: This is little complicated for me and I can't understand how this can be
: done.
:
: My problem is I get records from the database put it in the html table
: like..
:
: Table heading
:
: Name Age Rollno
:
: Jon 27 1
:
: Smith 28 2
:
: Phil 34 3
:
: .......
:
: ....... etc..
:
:
:
: Now what I want if some user clicks on the table heading "Name" the
: records should be sorted name wise or clicks on heading "Age" should be
: sorted age wise or "Rollno" should be sorted rollno wise.
:
: I do know understand how to do this .
:
: If anybody has got any sample or any help how to do this would be a real
: help.
:
: Thanks for the help.
:
: Regards
:
:
:
:
:
:
: ---------------------------------
: Get a bigger mailbox -- choose a size that fits your needs.
:
:
: ---
:
: Improve your web design skills with these new books from Glasshaus.
:
: Usable Web Menus
: http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
: r-20
: Constructing Accessible Web Sites
: http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
: r-20
: Practical JavaScript for the Usable Web
: http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
: r-20
:
:
:
: ---------------------------------
: Get a bigger mailbox -- choose a size that fits your needs.
:
:
:
: ---
:
: Improve your web design skills with these new books from Glasshaus.
:
: Usable Web Menus
: http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
: r-20
: Constructing Accessible Web Sites
: http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
: r-20
: Practical JavaScript for the Usable Web
: http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
: r-20
|
|
 |