This problem is not specific to the sorting situation. Any time you want to maintain state with regular links (as opposed to forms), you need to include all the information that the requested script will need in each link. In your particular case this means that each of the 8 header links will include 14 fields (the values passed from the 13 textboxes, plus the sort field).
The HTML code does end up looking a little confusing, but fortunately it is interpreted by software (the browser) and you never have to see it. Also, you don't have to hand-craft each link separately. You can simply create a common query string containing the values of the 13 text boxes and use that in each link. The following code URLEncodes the values, to avoid problems in case they contain special characters, such as quotes and ampersands:
Once you create this variable, you can simply add it to the query string of each of the sort links. The following code uses square brackets as string delimiters to make it easier to read, but you could also use single quotes:
Sent by Tim Bowen on 10/27/2004 05:36:48 AM:
So if a page returns 8 unique columns worth of info with each column having a hyperlinked header such as status, custname,price, date of order, date of delivery, costctr etc... to sort on, this is going to cause quite a complex html out line isn't it becasue the previous page, there are about 13 input textboxes for the user to fill out plus checkboxes and dropdown choices as well to narrow his search down.
So I will have to account for about 20 variables in an html line? This is starting to sound out of the question. Unless I am misunderstanding something.
Sent by Tim Bowen on 09/28/2004 01:22:44 PM:
I want to be able to include clickable sort header titles to my output. So if a user gets results returned like you see here