Jump to content

choosing asc or desc


lordfa9

Recommended Posts

i know this can be done by creating many pages and sneakily changing the link's variable (causing the user to alternate between two almost similar pages), but i can't cause this will cause me to create a lot of pages i was just wondering if there was any way to use allow user to choose how to sort a series of records in accending order or descending order using a querystring. For example, the records originally display in no particular order but by clicking a link, the records are arranged in accending order, clicking it again makes the records sort in descending order, a further click makes it sort in accending order and so on

Link to comment
Share on other sites

You will need to create a sort function to accept the array to be sorted and whether it is asc or desc.

Sub DoSort(arr, order)  If order = "asc" Then	'sort asc  Else	'sort desc  End If  DoSort = arrEnd Sub

Then you would call the function like this

dim sortedArray = DoSort(arrayToSort, Request.QueryString("order"))

assuming the querystring you are passing is called order and you use the values asc or desc.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...