[? ASP]Problema con paginazione risultati ricerca con db access
Autore
Messaggio
zuril Principiante
5 Discussioni
08 maggio 2003 alle 09:51:43 Modificato il 18 maggio 2003 alle 13:26:17Ciao a tutti, come va? Ho qualche problemino a visualizzare i risultati di una ricerca divise per pagine. Il passaggio da una pagina all'altra viene effettuato tramite bottoni di una form (Primo-Precedente-Succcessivo-Ultimo). Il problema, e' che dopo aver visualizzato la prima pagina, premendo su successivo, la pagina sembra cambiare per un attimo, tanto che compare la scritta "Pagina 2", poi torna subito su Pagina 1. Di seguito posto il codice della pagina Results.asp che e' la pagina "incriminata" sperando di poter trovare un valido aiuto per risolvere questo problema che ormai e' diventato un vero incubo... :
<%@ Language=VB_Script %> <% '-------------------------------------------------------------------------------------------- ' PageDB1.asp ' Window to display a page of query result. '-------------------------------------------------------------------------------------------- %>
<!-- #include file="BATSRC.inc" --> <% Response.Buffer=True On Error Resume Next %>
<% mPageNo = 1 ' Where there to begin the recordset objRS.AbsolutePage = mPageNo %>
<% IF mPageCount > 1 Then mPageNo = Request.Form("RefPageNo") If mPageNo <> "" Then mPageNo = Cint(mPageNo) Else mPageNo = 1 End If Else ' First run, then no buttons mPageNo = 1 End If
' Where there to begin the recordset objRS.AbsolutePage = mPageNo %>
<SCRIPT Language="VB_Script"> <!-- Function UpdPageNo(inNum)
Dim Pg, PgVal, ctn, ctnVal
' Pg=Parent.Frames("inferioredx").Document.Forms(0).Elements("RefPageNo").Value Pg=Document.Forms(0).Elements("RefPageNo").Value PgVal = Cint(Pg) ' Ctn=Parent.Frames("inferioredx").Document.Forms(0).Elements("RefPageCount").Value Ctn=Document.Forms(0).Elements("RefPageCount").Value ctnVal = Cint(ctn) IF inNum = 1 Then PgVal = 1 ElseIf inNum = 2 Then PgVal = PgVal -1 IF PgVal < 1 Then PgVal = 1 End If ElseIf inNum = 3 Then PgVal = pgval+1 IF PgVal > ctnVal Then PgVal = ctnVal End If ElseIf inNum = 4 Then PgVal = ctnVal End If 'Parent.Frames("inferioredx").Document.Forms(0).Elements("RefPageNo").Value = Cstr(PgVal) Document.Forms(0).Elements("RefPageNo").Value = Cstr(PgVal) document.all("PageNoFlag").innerText = "Pagina " & Cstr(PgVal) & " di " & Cstr(ctnVal) End Function //--> </SCRIPT>
<TABLE CELLPADDING=6 CELLSPACING=0 BORDER=1 WIDTH=100% text="#FFFFFF" style="color: #FFCC00; font-weight: bold; font-family: Arial; font-size: 10 pt"> <THEAD> <% ' Write headings using field names For Each Item in objRS.Fields %> <TH><%= Item.Name %></TH>
<% Next %> </THEAD>
<% ' Write records, limited by records available and the page size. j = mPageSize Do While Not objRS.EOF And j > 0 %>
<TR>
<% For i = 0 to mFieldCount-1 mFieldType = objRS.Fields(i).Type ' Avoid "3" mistakenly excluded when mExcludeFieldTypes has "123". If Len(mFieldType) < 3 Then mFieldType = mFieldType & "XX" End If ' Avoid fields such as binary If InStr(mExcludeFieldTypes, mFieldType) = 0 Then mFieldContent = objRS.Fields(i) IF TRIM(mFieldContent)= "" or mFieldContent = Null then ' Avoid broken grids