How many results at one page? Support
This FAQ explains how you can have your visitors decide how many records they want to be displayed in a repeat region (for example after a search performed on your site).
Note: This example code is ASP/VBScript only, but the same concept works for other Server Languages.
On the page where you let the user enter the search variables add an extra form field. For example a drop down list like this one
<select name="record_pp">
<option value="5">5</option>
<option value="10" selected>10</option>
<option value="15">15</option>
<option value="20">20</option>
<option value="25">25</option>
<option value="30">30</option>
</select>
On the resultspage search for this piece of code:
<%
Dim Repeat1__numRows
Repeat1__numRows = 20
Dim Repeat1__index
Repeat1__index = 0
rsMyRecordset_numRows = rsMyRecordSet_numRows + Repeat1__numRows
%>
In red you can see the number the page would return normally. In this case it would be 20.
Now replace this number with the following
Request.QueryString("records_pp") (if the form method = GET) or
Request.Form("records_pp") (if the form method = POST)
Now your code shoud look something like this:
<%
Dim Repeat1__numRows
Repeat1__numRows = Request.QueryString("records_pp")
Dim Repeat1__index
Repeat1__index = 0
rsCodesAll_numRows = rsCodesAll_numRows + Repeat1__numRows
%>
Make sure the name of the Request.QueryString (or Request.Form) corresponds with the name of the form field on the search page!
The only thing is that UD4 shows a red "!"in front of your repeat Region SB in the Server Behaviour Panel, but that's ok. It will work!!
Comments
Try this
If somone leaves the field blank, an error is generated, so try the following or if you wish, change Repeat1__numRows = -1 (all matching records) to a figure you decide is appropriate.
<%
Dim Repeat1__numRows
Repeat1__numRows = Request.QueryString("MaxRecords")
If Request.QueryString("MaxRecords") = "" Then Repeat1__numRows = -1 End If
Dim Repeat1__index
Repeat1__index = 0
Rs_numRows = Rs_numRows + Repeat1__numRows
%>
regards
Robert Egan
You must me logged in to write a comment.