Skip to main content
Participant
August 17, 2008
Answered

Repeat Region Dynamically change items per page

  • August 17, 2008
  • 3 replies
  • 329 views
Hi

Can anyone help on this one? I've set up a standard recordset (page uses ASP VB) to pull back a list of products, I wanted to give the user the option to be able to select the number of product shown per page (10, 25, 50 etc.) using a menu field, so I edited the repeat region behaviour so that the line now pulls the variable from the form Repeat1__numRows = Request.Form("itemsperpage"). This works great, the form field submits onChange and the number of products shown changes correctly.

The problem is that when you first load the page no products are shown until you select a number from the form field. So, to try to get over this I then added an onload event to the body tag to submit the page but then the problem happens that the page continually reloads itself, I've also tried some javascript so that the page just reloads the once but to no avail.

Basically, I just want an initial number of products to show when the page loads, then to be able to use the form field to allow the user to alter the number shown per page.

Many thanks if anyone has any idea how I can best achieve this.

Cheers
This topic has been closed for replies.
Correct answer xetra21
Setting a default value wouldn't work, the solution did however come to me and seems to work OK. Here's the new repeat region code:

<%
Dim Repeat1__numRows
Dim Repeat1__index


If Request.Form("itemsperpage")="" Then
Repeat1__numRows = 20
Else
Repeat1__numRows = Request.Form("itemsperpage")
End if

Repeat1__index = 0
rsProducts_numRows = rsProducts_numRows + Repeat1__numRows
%>

3 replies

Inspiring
August 18, 2008
xetra21 wrote:
> Setting a default value wouldn't work, the solution did however come to me and
> seems to work OK. Here's the new repeat region code:

What you have done *is* setting a default value, its how I do it.
Congrats for working it out!

Dooza
xetra21AuthorCorrect answer
Participant
August 17, 2008
Setting a default value wouldn't work, the solution did however come to me and seems to work OK. Here's the new repeat region code:

<%
Dim Repeat1__numRows
Dim Repeat1__index


If Request.Form("itemsperpage")="" Then
Repeat1__numRows = 20
Else
Repeat1__numRows = Request.Form("itemsperpage")
End if

Repeat1__index = 0
rsProducts_numRows = rsProducts_numRows + Repeat1__numRows
%>
Participant
August 17, 2008
Why not give, menu default value of 10 if its working ?