Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

advanced querystrings

0 views
Skip to first unread message

Michael Baker

unread,
Jul 24, 2002, 9:27:06 PM7/24/02
to
Does anyone have any good examples of working with advanced
querystrings?

I have 3 variations (see below) that I need to work together with the
same recordset on the same page.

One Set: Sort By: price/part number
Second Set: Display Number of Records 5/10/25/50/all per page
Third Set: Go to Page: 1/2/3/4/etc.

So, user sees default results of products (sorted by price, 5 records
per page, and page number 1). If the user sorts by part number, it
will display sorted by part number, 5 records per page, still on page
1. If they then click on 25 items per page, the sort method (part
number) still happens, they receive 25 items per page, and are still
on page one. etc, etc, etc.

Does this information make sense? Thanks in advance.

Michael Baker
de...@inetware.net

Ken Schaefer

unread,
Jul 24, 2002, 10:23:00 PM7/24/02
to
I don't think this it'd be too complex to implement.

You need to split your logic into two parts:
Part 1: initialising and setting various variables (sort order, page number,
records per page)
Part 2: constructing the resultset.

<%
Dim strSortBy ' Column to Sort by
Dim intPage ' the page to display
Dim intRecsPerPage ' records per page

intRecsPerPage = Request.QueryString("Recs")
intPage = Request.QueryString("Page")
strSortBy = Request.QueryString("SortBy")

If strSortBy <> "Field1" and strSortBy <> "Field2" then
' Set the default sort by
strSortBy = "Field1"
End If

If intRecsPerPage <> 5 and intRecsPerPage <> 10 then
intRecsPerPage = 5
End If

If not isNumeric(intPage) or Len(intPage & "") = 0 then
intPage = 1
Else
intPage = Abs(Int(intPage))
End If

' Now you have strSortBy, intPage and intRecsPagePage
' Apply your normal paging routines

Cheers
Ken


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"Michael Baker" <de...@inetware.net> wrote in message
news:bac07508.02072...@posting.google.com...

0 new messages