Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 12
  1. #1
    Utente di HTML.it
    Registrato dal
    Mar 2003
    Messaggi
    56

    paginazione che non funziona sulla seconda pagina

    Ho un problema di paginazione. Funziona sulla prima pagina ma non sulla seconda nel senso che quando clicco su pagina successiva la pagina risulta vuota. Non capisco dive sbaglio.
    Questo è il codice della pagina:

    Sub DrawResults()

    Dim Keyword, Keyword02, SQL, j, TheSet, ConnObj, iResultCount, iPageCount, iPageCurrent, iPageSize, Reviews, ReviewCount, GetOverallRating

    Keyword = trim(replace(Request.Form("keyword"),"'","''",1))
    Keyword02 = trim(replace(Request.Form("keyword02"),"'","''",1) )


    SQL = "SELECT Top 3000 * FROM Tabella_Siti WHERE "

    if Keyword="" and Keyword02="" then
    response.write "<font class='general_page_header'>"
    response.write("Attenzione: devi inserire alemno un valore per eseguire la ricerca")
    response.write "</font>"
    response.end
    end if


    If Keyword <> "" then

    SQL = SQL & "Tabella_Siti.Descrizione LIKE '%" & Keyword & "%' AND "

    End if


    If Keyword02 <> "" then

    SQL = SQL & "Tabella_Siti.Provincia = '" & Keyword02 & "' OR "
    SQL = SQL & "Tabella_Siti.Prov = '" & Keyword02 & "' OR "
    SQL = SQL & "Tabella_Siti.Citta = '" & Keyword02 & "' OR "
    SQL = SQL & "Tabella_Siti.Regione = '" & Keyword02 & "' OR "

    End if


    If right(SQL,3) = "OR " then SQL = left(SQL,len(SQL)-3) & "AND "

    if DatabaseType = "Access" then
    SQL = SQL & "(PublishOnWeb = True)"
    else
    SQL = SQL & "(PublishOnWeb = 1)"
    end if

    if request.form("order") = "created" then
    SQL = SQL & " ORDER BY Tabella_Siti.Created "
    elseif request.form("order") = "title" then
    SQL = SQL & " ORDER BY Title "
    elseif request.form("order") = "Descrizione" then
    SQL = SQL & " ORDER BY Descrizione "
    elseif request.form("order") = "servizi" then
    SQL = SQL & " ORDER BY Servizi "
    end if

    if request.form("sort") = "ASC" then
    SQL = SQL & "ASC"
    elseif request.form("sort") = "DESC" then
    SQL = SQL & "DESC"
    end if


    if Debug = True then response.write SQL

    If request.queryString("page") = "" Then
    iPageCurrent = 1
    Else
    iPageCurrent = CInt(request.queryString("page"))
    End If


    Set ConnObj = Server.CreateObject("ADODB.Connection")
    ConnObj.Open MyConnStr
    Set TheSet = Server.CreateObject("ADODB.Recordset")
    TheSet.CursorLocation = 3
    TheSet.PageSize = LinksPerPage
    TheSet.Open SQL, ConnObj

    iPageCount = TheSet.PageCount


    Response.write "<table width='100%' align='center' cellpadding='7' cellspacing='0'>"

    if TheSet.EOF or TheSet.BOF then ' no records found

    response.write "<tr><td valign='top'></td></tr>"
    response.write "<tr><td bgcolor='#F9F9F9'>"
    response.write "<font class='general_text'>"
    response.write "Non sono stati trovati dati."
    response.write "</font>"
    response.write "</td></tr>"
    response.write "<tr><td bgcolor='#ffffff'>"
    response.write "<font class='general_text'>"
    response.write "Riprova la ricerca con altri criteri"
    response.write "</font>"
    response.write "</td>"
    response.write "</tr>"

    else

    if Keyword = "" then
    response.write "<tr><td valign='top'></td></tr>"
    response.write "<tr><td>"
    response.write "<font class='general_page_header'>"
    response.write "Attenzione devi inserire cosa vuoi cercare !"
    response.write "</font>"
    response.write "</td></tr>"
    end if

    if Keyword02 = "" then
    response.write "<tr><td valign='top'></td></tr>"
    response.write "<tr><td>"
    response.write "<font class='general_page_header'>"
    response.write "Attenzione devi inserire il luogo !"
    response.write "</font>"
    response.write "</td></tr>"
    end if


    if Keyword <> "" then

    response.write "<tr><td valign='top'></td></tr>"
    response.write "<tr><td bgcolor='#F9F9F9'>"
    response.write "<font class='general_page_header'>"
    response.write "Risultati della ricerca per " & Keyword
    response.write "</font>"
    response.write "</td></tr>"

    end if

    response.write "<tr><td valign='top'></td></tr>"
    response.write "<tr><td bgcolor='#ffffff'>"


    response.write "<font class='page_results_count'>"
    response.write TheSet.RecordCount & " risultati trovati"
    response.write "</font>"

    response.write "</td></tr>"


    If 1 > iPageCurrent Then iPageCurrent = 1
    If iPageCurrent > iPageCount Then iPageCurrent = iPageCount
    TheSet.AbsolutePage = iPageCurrent
    iResultCount = (iPageSize * (iPageCurrent - 1)) + 1

    if NoCats = False then response.write "<tr><td bgcolor='" & CellSpilt & "'></td></tr>"


    response.write "<tr><td>"


    response.write "<table cellspacing='0' cellpadding='0' width='100%'>"
    response.write "<tr><form><td>"
    response.write "<font class='page_results_count'>"
    response.write "Pagina " & iPageCurrent & " di " & iPageCount & " - " & TheSet.RecordCount
    response.write " risultati</font>"
    response.write "</td><td align='right'>"

    response.write "<select name='order' onchange=""javascript:if (this.value != '') {self.location = '"
    response.write "cerca_rb.asp?page=" &_
    iPageCurrent & "&order=' + this.value + '&sortorder=' + sort.value + '&id=" & ID & "&parentID="
    response.write ParentID & "';}"">"

    response.write "<option value=''"
    if request.querystring("order") = "" then response.write "selected"
    response.write ">Ordina...</option>"
    response.write "<option value='TIT'"
    if request.querystring("order") = "TIT" then response.write "selected"
    response.write ">Ordina : Nome</option>"
    response.write "<option value='PRO'"
    if request.querystring("order") = "PRO" then response.write "selected"
    response.write ">Ordina : Provincia</option>"
    response.write "</select>"

    response.write ""

    response.write "<select name='sort' onchange=""javascript:self.location = '"
    response.write "cerca_rb.asp?page=" &_
    iPageCurrent & "&order=' + order.value + '&sortorder=' + this.value + '&id="
    response.write ID & "&parentID=" & ParentID & "';"">"
    response.write "<option value='ASC'"
    if request.querystring("sortorder") = "ASC" then response.write "selected"
    response.write ">Crescente</option>"
    response.write "<option value='DESC'"
    if request.querystring("sortorder") = "DESC" then response.write "selected"
    response.write ">Decrescente</option>"
    response.write "</select>"
    response.write "</td></form></tr></table>"

    response.write "</td></tr>"

    Do While TheSet.AbsolutePage = iPageCurrent And Not TheSet.EOF




    response.write "<tr><td colspan='2'></td></tr>"

    response.write "<tr><td>"


    response.write "<a class='listing_head' href='" & Path2Directory & "rb_dett.asp?siteid=" & TheSet("ID") & "' title='"
    response.write TheSet("Title") & "' target='_parent'>"

    If len(TheSet("Title")) >= 40 then
    response.write left(TheSet("Title"),40) & "..."
    else
    response.write TheSet("Title")
    end if

    response.write "</a>"


    response.write "
    "
    response.write "<font class='listing_Descrizione'>"
    if TheSet("cap") <> "" then response.write TheSet("cap")
    response.write ""
    if TheSet("citta") <> "" then response.write TheSet("citta")
    response.write ""
    if TheSet("prov") <> "" then
    response.write "("
    response.write TheSet("prov")
    response.write ")"
    end if
    response.write ""
    if TheSet("indirizzo") <> "" then
    response.write ""
    response.write "-"
    response.write ""
    response.write TheSet("indirizzo")
    end if
    response.write "
    "
    if TheSet("tel") <> "" then
    response.write "Tel:"
    response.write ""
    response.write TheSet("tel")
    end if
    response.write ""
    if TheSet("fax") <> "" then
    response.write "Fax:"
    response.write ""
    response.write TheSet("fax")
    end if
    response.write "</font>"


    response.write "

    "
    response.write "<table width='100%' cellspacing='0' cellpadding='0'><tr><td>"

    '*********************************
    '*** inserimento Vedi scheda ***
    response.write "<a class='bookmark_resource' href='" & Path2Directory & "rb_dett.asp?siteID="
    response.write TheSet("ID") & "' title='"
    response.write TheSet("Title") & "' target='_parent'>"
    response.write "</a>"
    response.write "<a class='bookmark_resource' href='" & Path2Directory & "rb_dett.asp?siteID="
    response.write TheSet("ID") & "' title='"
    response.write TheSet("Title") & "' target='_parent'>"
    response.write "Vedi Scheda</a>"
    '*** inserimento Vedi scheda ***
    '*********************************
    if TheSet("URL") <> "" then
    response.write " | "
    response.write "<font class='short_listing_url'>"
    response.write "<a href='" & Path2Directory & "vai_sito.asp?id=" & TheSet("ID") & "' class='short_listing_url' target='_blank'>"
    response.write "Internet"
    response.write "</a>"
    response.write "</font>"
    end if
    response.write "</td>"


    response.write "</tr>"
    response.write "<tr>"
    response.write "<td>"
    response.write "Categorie: "
    response.write " "

    i = 0
    ConstructTopNavigation TheSet("CategoryID")
    response.write TopNavLinks
    response.write "</td>"
    response.write "</tr>"
    response.write "</table>"

    response.write "</td></tr>"

    response.write "<tr><td class='TDtabella_view02'>"
    response.write " "
    response.write "</td></tr>"

    iResultCount = iResultCount + 1

    TheSet.MoveNext
    Loop

    response.write "<tr>"
    response.write "<td valign='top'>"

    response.write "<table width='100%' border='0' cellpadding='0' cellspacing='0'>"
    response.write "<tr><td width='20%' class='paging_links' align='left'>"

    If iPageCurrent > 1 Then

    response.write "&#171;<a class='paging_links' href='cerca_rb.asp?page="
    response.write iPageCurrent - 1
    response.write "&order=" & request.querystring("order")
    response.write "&sortorder=" & request.querystring("sortorder") & "&id=" & ID & "&parentID="
    response.write ParentID & "'>Pagina Precedente</a>"

    end if

    response.write "</td>"
    response.write "<td width='60%' class='paging_links' align='center'>"

    dim intStart, intEnd

    if iPageCount <> 1 then

    if iPageCurrent <= intPGCount Then
    intStart = 1
    Else
    If (iPageCurrent Mod intPGCount) = 0 Then
    intStart = iPageCurrent - intPGCountMinus
    Else
    intStart = iPageCurrent - (iPageCurrent Mod intPGCount) + 1
    End if
    End if

    intEnd = intStart + intPGCountMinus

    if intEnd > iPageCount Then intEnd = iPageCount

    for i = intStart to intEnd

    if i = intStart and i <> 1 then response.write "...&nbsp"

    if i = iPageCurrent then
    response.write "<font class='paging_links'>[ " & i & " ]</font>"
    else
    response.write "<a class='paging_links' href='cerca_rb.asp?page=" & i
    response.write "&order=" & request.querystring("order")
    response.write "&sortorder=" & request.querystring("sortorder") & "&id=" & ID
    response.write "&parentID=" & ParentID & "'>" & i & "</a>"
    end if

    if i <> intEnd then
    response.write ""
    else

    if i <> iPageCount then response.write "..."

    end if

    next

    end if

    response.write "</td>"
    response.write "<td width='20%' class='paging_links' align='right'>"

    If iPageCurrent <> iPageCount Then

    response.write "<a class='paging_links' href='cerca_rb.asp?page="
    response.write iPageCurrent + 1
    response.write "&order=" & request.querystring("order")
    response.write "&sortorder=" & request.querystring("sortorder") & "&id=" & ID & "&parentID="
    response.write ParentID & "'>Pagina Successiva</a>&#187;"

    end if

    response.write "</td></tr></table>"


    end if

    response.write "</td></tr>"
    response.write "</table>"

    Set TheSet = Nothing
    ConnObj.Close

    End Sub

  2. #2
    quanto siamo generici, che vuol dire che non funziona?

    hai provato a vedere se questa
    codice:
     response.write "<a class='paging_links' href='cerca_rb.asp?page=" & i
    response.write "&order=" & request.querystring("order")
    response.write "&sortorder=" & request.querystring("sortorder") & "&id=" & ID
    response.write "&parentID=" & ParentID & "'>" & i & "</a>"
    inserisci nell'href TUTTI i parametri necessari alla visualizzazione dei recordset che ti interessano?

  3. #3
    Utente di HTML.it
    Registrato dal
    Mar 2003
    Messaggi
    56
    Non funziona nel senso che questa funzione è il risultato di una ricerca. Mi compare la prima pagina con il numero di pagine, il numero fi elemnti presenti, ....
    ma quando clicco su pagina successiva non scrive i risultati.
    Penso che il problema possa essere dove lo hai individuato tu ma non riesco a capire come risolverlo.

  4. #4
    vedi l'html della prima pagina e dove c'è il menu delle pagine controlla che cosa c'è scritto sotto 2. almeno vediamo se non c'è li qualche errore


    ad occhio e croce è perchè tu hai usato request.querystring....mi chiedo la pagina 1 come possa avere un querystring

  5. #5
    Utente di HTML.it
    Registrato dal
    Mar 2003
    Messaggi
    56
    La pagina uno continene la form di ricerca:

    Sub ShowSearch()

    response.write "<table>"
    response.write "<tr>"
    response.write "<form action='cerca_rb.asp?action=search' method='POST' name='frmSearch'>"
    response.write "<td class='TDtabella_cerca01'><font class='general_small_text'>Cosa:</font>"
    response.write ""
    response.write "<input type='text' size='30' name='keyword' value='" & request.form("keyword") & "' class='input'>"
    response.write ""
    response.write "<font class='general_small_text'>Dove:</font>"
    response.write ""
    response.write "<input type='text' size='30' name='keyword02' value='" & request.form("keyword02") & "' class='input'> <input type='submit' class='form_buttons' name='submit' value=' Cerca '> </td>"

    response.write "</form></tr>"
    response.write "</table>"

    End Sub

  6. #6
    Utente di HTML.it
    Registrato dal
    Mar 2003
    Messaggi
    56
    Dimenticavo che la pagina che esegue la ricerca e da' il risultato in sintesi è questa:

    <%
    ShowSearch()
    %>
    <%
    With Response
    If Request.Querystring("action") = "search" then
    DrawResults()
    end if
    End With
    %>

  7. #7
    Utente di HTML.it L'avatar di Umanista
    Registrato dal
    Jan 2002
    Messaggi
    1,022
    Nella subroutine DrawResults() mi pare che siano usati dei Request.Form, e pertanto non è in grado di leggere i valori passati dalla querystring.

    Dovresti mettere delle condizioni, a seconda dei casi usi request.form o request.querystring

  8. #8
    Utente di HTML.it
    Registrato dal
    Mar 2003
    Messaggi
    56
    Ho modificato la parte di codice che mi rimanda alla pagina successiva in questo modi:

    response.write "<a class='paging_links' href='" & Path2Directory & "cerca_rb.asp?page=" & i
    response.write "&order=" & request.querystring("order")
    response.write "&sortorder=" & request.querystring("sortorder") & "&id=" & ID
    response.write "&parentID=" & ParentID & "&keyword=" & server.URLEncode(Keyword) & "&keyword02=" & server.URLEncode(Keyword02)
    response.write "&action=" & request.querystring("action") & "'>" & i & "</a>"

    per far passare i valori kayword e keyword02 anche nei campi form della ricerca nella pagina successiva. Infatti credo che il problema sia proprio lì. Ma i valori delle keyword non rimangono memorizzati e quindi non li vede nella pagina successiva...

  9. #9
    Utente di HTML.it L'avatar di Umanista
    Registrato dal
    Jan 2002
    Messaggi
    1,022
    Originariamente inviato da kunder
    La pagina uno continene la form di ricerca:

    Sub ShowSearch()

    response.write "<table>"
    response.write "<tr>"
    response.write "<form action='cerca_rb.asp?action=search' method='POST' name='frmSearch'>"
    response.write "<td class='TDtabella_cerca01'><font class='general_small_text'>Cosa:</font>"
    response.write ""
    response.write "<input type='text' size='30' name='keyword' value='" & request.form("keyword") & "' class='input'>"
    response.write ""
    response.write "<font class='general_small_text'>Dove:</font>"
    response.write ""
    response.write "<input type='text' size='30' name='keyword02' value='" & request.form("keyword02") & "' class='input'> <input type='submit' class='form_buttons' name='submit' value=' Cerca '> </td>"

    response.write "</form></tr>"
    response.write "</table>"

    End Sub
    Qui potresti usare il metodo get anziché post. In questo modo potresti usare sempre Request.Querystring risolvendo gran parte dei tuoi problemi

  10. #10
    o altrimenti usi il request generico

    codice:
    miaVar=request("nome_var")
    però devi stare attento a come lo utilizzi o ti si raddoppiano i valori

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.