Visualizzazione dei risultati da 1 a 3 su 3

Discussione: paginazione

  1. #1
    Utente di HTML.it
    Registrato dal
    Jul 2003
    Messaggi
    583

    paginazione

    <%
    Dim strSQL, rec, boolFound, intPageNum, intNumRows, intCount, intLinks, intPagina
    Const RECORDSPERPAGE = 6

    strSQL = "SELECT * FROM tabella1"

    Set rec = Server.CreateObject("ADODB.Recordset")
    rec.CursorLocation = adUseClient
    rec.Open strSQL, Conn, adOpenStatic, adLockReadOnly, adCmdText
    rec.PageSize = RECORDSPERPAGE

    If ( Request("pn") <> "" ) Then
    intPageNum = CInt(Request("pn"))
    Else
    intPageNum = 1
    End If

    'Conteggio delle righe
    intNumRows = rec.RecordCount

    If (intNumRows <> 0) Then
    rec.AbsolutePage = intPageNum
    'Esposizione dati
    For intCount = 1 To rec.PageSize %>





    <tr>
    <td align="center"> <div align="center">
    <center>
    <table width="299" bordercolor="#000000" border="1" height="146" cellspacing="0" cellpadding="0">

    <tr height="18" style="height:13.4pt">
    <td height="11" class="xl24" width="132"><font size="1" face="Tahoma">RIFERIMENTO
    / CODICE</font>
    </td>
    <td class="xl25" width="154" style="border-left-style: none; border-left-width: medium" height="11"><font size="1" face="Tahoma"><span style="background-color: #FF9999"><font size="1" face="Tahoma"><%=rec("riferimento")%></font></span></font></td>
    </tr>
    <tr height="18" style="height:13.4pt">
    <td height="10" class="xl26" style="border-top-style: none; border-top-width: medium" width="132"><font size="1" face="Tahoma">COMUNE</font></td>
    <td class="xl27" style="border-left-style: none; border-left-width: medium; border-top-style: none; border-top-width: medium" width="154" height="10"><font color="black" size="1" face="Tahoma"><%=rec("localita")%></font></td>
    </tr>

    <tr height="18" style="height:13.4pt">
    <td height="10" class="xl26" style="border-top-style: none; border-top-width: medium" width="132"><font size="1" face="Tahoma">TIPOLOGIA</font></td>
    <td class="xl27" style="border-left-style: none; border-left-width: medium; border-top-style: none; border-top-width: medium" width="154" height="10"><font size="1" face="Tahoma"><%=rec("tipologie")%></font></td>
    </tr>
    <tr height="19" style="height:14.25pt">
    <td height="11" class="xl28" style="border-top-style: none; border-top-width: medium" width="132"><font size="1" face="Tahoma">PREZZO</font></td>
    <td class="xl29" style="border-left-style: none; border-left-width: medium; border-top-style: none; border-top-width: medium" width="154" height="11"><font size="1" face="Tahoma"><%=rec("prezzo")%></font></td>
    </tr>
    <tr height="19" style="height:14.25pt">
    <td height="6" class="xl28" style="border-top-style: none; border-top-width: medium" width="132"><font size="1" face="Tahoma">MQ</font></td>
    <td class="xl29" style="border-left-style: none; border-left-width: medium; border-top-style: none; border-top-width: medium" width="154" height="6"><font size="1" face="Tahoma"><%=rec("mq")%></font></td>
    </tr>
    <tr height="19" style="height:14.25pt">
    <td height="100" class="xl28" style="border-top-style: none; border-top-width: medium" width="286" colspan="2"><font size="1" face="Tahoma"><%=rec("descrizione")%></font></td>
    </tr>
    <tr height="19" style="height:14.25pt">
    <td height="2" class="xl28" style="border-top-style: none; border-top-width: medium" width="286" colspan="2">
    <p align="center">" target="_blank">[img]<%=rec([/img]" border="0"></td>
    </tr>

    </table>
    <table width="100%">
    <tr>
    <td align="center"> <hr> </td>
    </tr>

    </table>
    </center>
    </div></td>
    </tr>





    <% rec.MoveNext
    If ( rec.EOF ) Then Exit For
    Next
    End If %>



    <tr>
    <td align="center">







    <% 'Navigazione sulle pagine
    If ( intNumRows > 0 ) Then

    Response.Write("<font size='2' face='Arial'>")
    Response.Write "Pagina " & intPageNum & " di " & rec.PageCount & "
    "

    'Pagina precedente
    If ( intPageNum > 1 ) Then
    Response.Write "&laquo;"
    End If


    'Numeri di pagina
    For intLinks = 1 To rec.PageCount
    intPagina = intPagina + 1
    If intPagina > 20 Then
    intPagina = 1
    Response.Write("
    ")
    End If
    If intLinks = intPageNum Then
    Response.Write "<font color='black'>" & intLinks & "</font>"
    Else
    Response.Write "" & intLinks & ""
    End If
    Next

    'Pagina successiva
    If ( intPageNum < rec.PageCount ) Then
    Response.Write "&raquo;"
    End If

    Response.Write("</font>")

    'Fine navigazione sulle pagine

    End If


    'Chiusura recordset
    rec.Close
    Set rec = Nothing
    %>




    salve questo script funziona come paginazione

    è solo un problema di struttura

    come faccio a modificare lo script x inserire la paginazione , oltre che alla fine, anche ad inizio pagina???

    fatemi sapere
    saluti

  2. #2
    Utente di HTML.it
    Registrato dal
    Jul 2003
    Messaggi
    583
    ??

  3. #3
    è semplicissimo:
    nei cicli che ti generano i numeri di pagine anzichè usare respose.write, inserisci tutto in una variabile. naturalmente sposti il ciclo + in su e usi la variabile per stampare sia sopra che sotto.
    "0 è tutto finito. 1 è solo l'inizio"
    HO IL CERTIFICATO DI RESISTENZA.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.