Forum 

[? ASP]Problema con paginazione risultati ricerca con db access

Autore Messaggio
zuril

Principiante
Principiante
5 Discussioni



Profilo - zuril
08 maggio 2003 alle 09:51:43 Profilo - zurilInvia un messaggio privato Rispondi quotando
Modificato il 18 maggio 2003 alle 13:26:17

Ciao 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.
'--------------------------------------------------------------------------------------------
%>


<% Option Explicit %>
<!-- #include file="Adovbs.inc" -->

<%
DIM Cerca
Dim Goldrake

Goldrake = Request.Querystring("CampoRicerca")

Cerca = Request.Querystring("Marca")

%>

<%
Function LinkURL(mfieldcontent)
Dim objRegExp, strTemp
Set objRegExp = New RegExp

objRegExp.IgnoreCase = True
objRegExp.Global = True
objRegExp.Pattern = "((www.|http://)S+)"
strTemp = objRegExp.replace(mfieldcontent, "<A HREF='http://$1' TARGET='_new'>$1</A>")
LinkURL = Replace(strTemp, "http://http://","http://")
Set objRegExp = Nothing
End Function
%>

<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<TITLE> Scrollable data display section </TITLE>
<link rel="StyleSheet" href="../../default.css" type="text/css">

<meta HTTP-EQUIV="Content-Type" content="text/html; charset=ISO-8859-1">
<STYLE> {FONT-FAMILY="Sans Serif"} </STYLE>
</HEAD>
<BODY BGCOLOR="#006600" TOPMARGIN=5 text="#FFFFFF" style="color: #FFFFFF; font-weight: bold">

<!-- #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
%>



<p>
<BR>

<FORM NAME="UpdPage" TARGET="inferioredx" ACTION="Results.asp" METHOD="GET">
<TABLE COLS="3" BORDER="0" WIDTH="100%">
<TR>
<TD ALIGN=Left><B>
<DIV ID = 'PageNoFlag'><font color="#FFCC00">Pagina <% =Cstr(mPageNo) %> di <% =Cstr(mPageCount) %></B></font></DIV>
</TD>

<TD ALIGN=CENTER>
<INPUT TYPE="HIDDEN" NAME="RefPageNo" VALUE="<%=cstr(mPageNo)%>">
<INPUT TYPE="HIDDEN" NAME="RefPageCount" VALUE="<%=cstr(mPageCount)%>">
<INPUT TYPE="HIDDEN" NAME="CampoRicerca" VALUE="<%=Request.QueryString("CampoRicerca")%>">
<INPUT TYPE="HIDDEN" NAME="Marca" VALUE="<%=Request.QueryString("Marca")%>">
<% If mPageCount = 1 Then %>
<INPUT TYPE="SUBMIT" NAME="OfFirst" VALUE="Primo" STYLE="position: RELATIVE; background-color: #009933; color: #000000; font-weight: bold; border-style: double; border-color: #FFCC00" DISABLED="True">
<INPUT TYPE="SUBMIT" NAME="OfPrevious" VALUE="Prec." STYLE="position: RELATIVE; background-color: #009933; color: #000000; font-weight: bold; border-style: double; border-color: #FFCC00" DISABLED="True">
<INPUT TYPE="SUBMIT" NAME="OfNext" VALUE="Succ." STYLE="position: RELATIVE; background-color: #009933; color: #000000; font-weight: bold; border-style: double; border-color: #FFCC00" DISABLED="True">
<INPUT TYPE="SUBMIT" NAME="OfLast" VALUE="Ultimo" STYLE="position: RELATIVE; background-color: #009933; color: #000000; font-weight: bold; border-style: double; border-color: #FFCC00" DISABLED="True">
<% ElseIf mPageCount = 2 Then %>
<INPUT TYPE="SUBMIT" NAME="OfPrevious" VALUE="Prec." STYLE="position: RELATIVE; background-color: #009933; color: #000000; font-weight: bold; border-style: double; border-color: #FFCC00" ONCLICK="UpdPageNo(2)">
<INPUT TYPE="SUBMIT" NAME="OfNext" VALUE="Succ." STYLE="position: RELATIVE; background-color: #009933; color: #000000; font-weight: bold; border-style: double; border-color: #FFCC00" ONCLICK="UpdPageNo(3)">
<% ElseIf mPageCount > 2 Then %>
<INPUT TYPE="SUBMIT" NAME="OfFirst" VALUE="Primo" STYLE="position: RELATIVE; background-color: #009933; color: #000000; font-weight: bold; border-style: double; border-color: #FFCC00" ONCLICK="UpdPageNo(1)">
<INPUT TYPE="SUBMIT" NAME="OfPrevious" VALUE="Prec." STYLE="position: RELATIVE; background-color: #009933; color: #000000; font-weight: bold; border-style: double; border-color: #FFCC00" ONCLICK="UpdPageNo(2)">
<INPUT TYPE="SUBMIT" NAME="OfNext" VALUE="Succ." STYLE="position: RELATIVE; background-color: #009933; color: #000000; font-weight: bold; border-style: double; border-color: #FFCC00" ONCLICK="UpdPageNo(3)">
<INPUT TYPE="SUBMIT" NAME="OfLast" VALUE="Ultimo" STYLE="position: RELATIVE; background-color: #009933; color: #000000; font-weight: bold; border-style: double; border-color: #FFCC00" ONCLICK="UpdPageNo(4)">
<% End If %>

</TD>

<TD ALIGN=Right>
<B><font color="#FFCC00">Numero Prodotti trovati:  <%=Cstr(mRecordCount)%></B></font>
</TD>
</TR>
</TABLE>
</FORM>


<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


%>

<TD style="color: #FFFFFF; font-size: 8 pt">-</TD>
<%

Else

IF mFieldContent = "-" then
Response.write ("-")
End if %>

<% if mFieldContent <> "-" then%>
<TD style="color: #FFFFFF; font-size: 8 pt"> <%= (LinkUrl(mfieldcontent)) %></TD>


<% End if %>






<%


End if
End If
Next

%>

</TR>

<%
j = j - 1
objRS.MoveNext
Loop
%>


</TABLE>

</FORM>




</BODY>
</HTML>



<%
objRS.Close
Set objRS = Nothing
Set cmdConn = Nothing
objConn.Close
Set objConn = Nothing
Response.End
%>

Grazie 1000 per tutto l'aiuto che vorrete darmi [lo]

Log in

Login
Password
Memorizza i tuoi dati:

Cerca

 

Sostieni AspNuke

Un piccolo gesto per aiutarci a mantenere AspNuke.it online

Promo

MusicWebItalia.it
Video Testi Traduzioni Spot Colonne sonore Accordi e Spartiti gratis.

Visitatori

Visitatori Correnti : 217
Membri : 0 offline Anna

Iscritti

 Utenti: 18940
Ultimo iscritto : glauco
Lista iscritti
Messaggi privati: 3373 Commenti: 2210 Immagini: 39 Downloads: 144 Articoli: 49 Pagine: 101 Siti web: 558 Notizie: 180 Sondaggi: 11 Preferiti: 5685324 Post sui forum: 51195 Libro degli ospiti: 4 Eventi: 7

Versioni

Temi