Forums
 This topic is locked 
             how to sort table column heading code?
 08 Mar 2003  15:50:11 h b posted: 
 morning,Couuld anyone help me with a means of adding a sort table column heading server behavior for a recordset? I've come across buyable behaviours but I don't think that this is so complex that I need to get them. I haven't found anything codewise that is complete enough for someone who is learning as I am. ASP and Access and Dw MX is what I'm working with.
thanks
Bob
Replies
 Replied 15 Mar 2003  01:14:52 
   15 Mar 2003  01:14:52 Phil Shevlin replied: 
  The simplest (but not the most ideal) way...
Create a recordset that sorts by a column
Modify your code. Look for
ORDER BY YourField ASC"
Change to
ORDER BY " & request.querystring("SortBy"
Then put links in your table header that include parameters:
<pre id=code><font face=courier size=2 id=code>
<a href="default.asp?SortBy=ClientName">Client Name</a>
</font id=code></pre id=code>
  Create a recordset that sorts by a column
Modify your code. Look for
ORDER BY YourField ASC"
Change to
ORDER BY " & request.querystring("SortBy"

Then put links in your table header that include parameters:
<pre id=code><font face=courier size=2 id=code>
<a href="default.asp?SortBy=ClientName">Client Name</a>
</font id=code></pre id=code>