|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Pagnation - Page redirects fail
I've spent an excessive amount of time developing an Db and an ASP web site. The queries all work (connections are made and record sets opened and close, etc.). Now I've become bogged down with my pagnation attempts! The page includes a script that sets the page size, presents the number of pages and lists the successive page options, etc. With the initial search, this all seems to work. The problem appears when one of the next page selections are made. What I receive is just the page, returned at the beginning (where the selections can be made). This one has frustrated me - so any help is appreciated.
|
|
#2
|
||||
|
||||
|
If you are on page1, are you telling the next page that you are now on page 2? Ex:
'---get the current page being passed in nCurPage = Trim ( Request.QueryString ( "curpage" ) ) '---set recorset page size and absolutevalues... Rs.PageSize = 15 '--15 items per page Rs.AbsolutePage = nCurPage '--what page are we on |
|
#3
|
|||
|
|||
|
Still Trying
I've spent so much time on this, I'm going feel real stupid when I finally find the answer! I receive the following error when I try to include your line
Type mismatch:'[string: ""]' Here's the code: <%@ Language=VBScript %> <% Option Explicit %> <% ' ADO constants used in this page Const adLockReadOnly = 1 Const adCmdTableDirect = &H0200 Const adUseClient = 3 Dim conn set conn=Server.CreateObject("ADODB.Connection") conn.open "FILEDSN=[domain]_[db]_[dsn];UID=;PWD=" Dim rs21 set rs21=CreateObject("ADODB.RecordSet") rs21.Open "SELECT DISTINCT community FROM comdefinex2 ORDER BY comdefinex2.community",conn Dim Community community=request.form("community") %> <form method="post" action="<%=Request.ServerVariables("SCRIPT_NAME")%>"> <select name="community" style="font-family: Arial; color: #555555; font-size: "1"" onBlur="java_script_:validateField(this.value, 'Community')"> <option value="Select a Community">-- Select a Community --</option> <% do until rs21.EOF response.write("<option") if rs21.fields("community")=community then response.write(" selected") end if response.write(">") response.write(rs21.fields("community")) rs21.MoveNext loop rs21.close set rs21=nothing %> </select> <% Dim rs22 set rs22=CreateObject("ADODB.RecordSet") rs22.Open "SELECT DISTINCT area FROM pricatbusdefin ORDER BY pricatbusdefin.area",conn Dim Area area=request.form("area") %> <select name="area" style="font-family: Arial; color: #555555; font-size: "1"" onBlur="java_script_:validateField(this.value, 'Business Category')"> <option value="Select an Area">-- Select a Business Category --</option> <% do until rs22.EOF response.write("<option") if rs22.fields("area")=area then response.write(" selected") end if response.write(">") response.write(rs22.fields("area")) rs22.MoveNext loop rs22.close set rs22=nothing %> </select> <input type="submit" value="Check Our Lists"> <input type="button" name="btnRestart" value="Try Another Selection" onclick="javascript: window.location='<%=Request.ServerVariables("SCRIPT_NAME")%>'"> </form> <% Dim rs Dim record Dim adOpenStatic Dim adStateOpen record=1 if community<>"" then set rs=CreateObject("ADODB.RecordSet") rs.ActiveConnection = conn rs.CacheSize = 15 rs.CursorLocation = adUseClient rs.CursorType = adOpenStatic rs.Open "SELECT ..........................FROM ...................WHERE ..................ORDER BY .................", conn, adLockReadOnly rs.PageSize = 5 Dim abspage, pagecnt abspage = rs.AbsolutePage pagecnt = rs.PageCount Dim nCurPage if not rs.EOF then If Len(Request("pagenum")) = 0 Then rs.AbsolutePage = 1 Else If CInt(Request("pagenum")) <= rs.PageCount Then rs.AbsolutePage = Request("pagenum") Else rs.AbsolutePage = 1 End If End If %> <tr><td><font ...........><b>We have found <%=rs.RecordCount%> listings that match your request.</font></td></tr> <% Do While Not rs.EOF AND Record <= rs.pagesize response.write rs("listingname") If Len(rs("mphone")) > 0 then Dim re2 Set re2 = New RegExp re2.Pattern = "(\d{3})(\d{3})(\d{4})" Response.Write re2.Replace(rs("mphone"), "($1) $2 - $3") Set re2 = Nothing End If response.write("<br />") Dim suite Dim civic Dim street Dim province Dim pcode Dim mcstatdefin Dim restatdefin Dim profilepg suite=rs("suite") if suite<>"" then response.write rs("suite") response.write(" - ") end if civic=rs("civic") if civic<>"" then response.write rs("civic") response.write(", ") end if response.write rs("street") response.write(", ") response.write rs("community") response.write(", ") response.write rs("province") response.write(" ") pcode=rs("pcode") if pcode<>"" then response.write rs("pcode") end if response.write("<br />") response.write"Member Choice Status is" response.write rs("mcstatdefin") response.write("<br />") response.write"Recommended Status is" response.write rs("restatdefin") response.write("<br />") profilepg=rs("profilepg") if profilepg<>"b111111.asp" then <a href="<%response.write rs("profilepg")%>" style="text-decoration: blink"><font size="2" face="arial" color="ffffff"><b>Visit Our Profile</b> <% end if Record = Record + 1 rs.movenext loop ' Now showing first, next, back, last buttons. ' abspage = Trim ( Request.QueryString ( "pagenum" ) ) Response.Write "<div align=""center"">" & vbcrlf Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") & "?pagenum=1"">First Page</a>" Response.Write " | " If abspage = 1 Then Error referrs to this line! Response.Write "<span style=""color:silver;"">Previous Page</span>" Else Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") & "?pagenum=" & abspage - 1 & """>Previous Page</a>" End If Response.Write " | " If abspage < pagecnt Then Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") & "?pagenum=" & abspage + 1 & """>Next Page</a>" Else Response.Write "<span style=""color:silver;"">Next Page</span>" End If Response.Write " | " Response.Write "<a href=""" & Request.ServerVariables("SCRIPT_NAME") & "?pagenum=" & pagecnt & """>Last Page</a>" Response.Write "</div>" & vbcrlf else response.write("Sorry, we have found no matches. ") response.write("<br />") response.write("Please redefine your search criteria and try once again.") end if end if 'Object cleanup If IsObject(rs) Then If Not rs Is Nothing Then If rs.State = adStateOpen Then rs.Close Set rs = Nothing End If End If If IsObject(conn) Then If Not conn Is Nothing Then If conn.State = adStateOpen Then conn.Close Set conn = Nothing End If End If %> |
|
#4
|
||||
|
||||
|
Try:
If abspage = "1" Then Send me a private message with your email and I will email you a page I made with paging. |
|
#5
|
|||
|
|||
|
Thanks
Thanks for all the assistance. I have it working great now. ASP Free Forums "ROCKS"!
|
![]() |
| Viewing: ASP Free Forums > Other > Programming Help > Pagnation - Page redirects fail |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|