Hi Nagesh,
Firstly, you need to display the column headings in a table-like structure, then for each column heading, you need to set the heading to be a link, and pass a parameter (e.g. orderby=column-name).
Then, in your SQL code in your ASP page, you do a test to see whether the column to be ordered by has been specified:
-
If Request.QueryString("order-by") <> "" Then
-
If Request.QueryString("order-dir") <> "" Then
-
strSQL = strSQL + " ORDER BY " + Request.QueryString("order-by") + " " + Request.QueryString("order-dir")
-
Else
-
strSQL = strSQL + " ORDER BY " + Request.QueryString("order-by")
-
End If
-
End If
-
Then, your links will look something like this:
-
<tr>
-
<td><a href="yourpage.asp?order-by=title&order-dir=asc">Title</a></td>
-
<td><a href="yourpage.asp?order-by=FName&order-dir=asc">FName</a></td>
-
<td><a href="yourpage.asp?order-by=LName&order-dir=asc">LName</a></td>
-
etc. etc.
-
</tr>
-
Hope this helps.
Best regards,
medicineworker