Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Repeat Region Dynamically change items per page

New Here ,
Aug 17, 2008 Aug 17, 2008
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
TOPICS
Server side applications
331
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

New Here , Aug 17, 2008 Aug 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
%>
Translate
New Here ,
Aug 17, 2008 Aug 17, 2008
Why not give, menu default value of 10 if its working ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 17, 2008 Aug 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
%>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 18, 2008 Aug 18, 2008
LATEST
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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines