OLÁ, GALERINHA TUDO BEM? eSTOU AQUI DE VOLTA POIS TO COM UM PROBLEMA MÉDIO.
estou COM UM CÓDIGO DE PAGINAÇÃO, MAS EU QUERIA QUE A PAGINA ATUAL, OU SEJA AQUELA QUE ESTEJA SENDO EXIBIDA FIQUE DESLINKADA OU INATIVA.
TAMBÉM GOSTARIA DE SABER COMO FAÇO PARA EXIBIR APENAS 5 PÁGINAS POR VEZ
ABAIXO VAI O CODIGO
<% Response.Buffer = True %>
<%
Dim adoCon
Dim rs
Dim strCon
Dim strAccessDB
Dim strSQL
Dim strPreviousPollQuestion
Dim intPreviousPollQuestionID
Dim dtmPreviousPollQuestionDate
Dim intRecordPositionPageNum
Dim intRecordLoopCounter
Const intRecordsPerPage = 2
If Request.QueryString("PaginaAtual") = "" Then
intRecordPositionPageNum = 1
Else
intRecordPositionPageNum = CInt(Request.QueryString("PaginaAtual"))
End If
%>
<html>
<head>
<title>TESTE DE PAGINAÇÃO</title>
<style>
a{color:#ff0000;text-decoration:none}
a:hover{padding-left:3;color:#336699;text-decoration:underline}
</style>
</head>
<body bgcolor="#ffffff" style="font-family: verdana; font-size: 12">
<div align="center">
<span style="font-family:verdana;font-size:17;font-weight:bold;color:#336699">Teste Do Livro</span>
<table width="370" border="0" cellspacing="0" cellpadding="1">
<%
strAccessDB = "banco"
Set adoCon = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
'Abre conexao com o banco de dados
strCon="DRIVER={Microsoft Access Driver (*.mdb)};"
strCon = strCon & "DBQ=" & Server.MapPath(strAccessDB)
strSQL = "SELECT * FROM banco ORDER By id DESC"
rs.Open strSQL, strCon, 3
TotalDEGravacoes = rs.RecordCount
TotalDePaginas = int(TotalDEGravacoes/intRecordsPerPage)
If TotalDEPaginas MOD intRecordsPerPage <> 0 Then
TotalDEPaginas = TotalDePaginas + 1
end if
rs.PageSize = intRecordsPerPage
If NOT rs.EOF Then rs.AbsolutePage = intRecordPositionPageNum
For intRecordLoopCounter = 1 to intRecordsPerPage
'If there are no more previous Poll Question records left to display then exit loop
If rs.EOF Then Exit For
Response.Write "<tr>"
Response.Write "<td width=""250"">Nome: <b>" & rs("nome") & "</b></td></tr><tr>"
Response.Write "<td width=""120"" align=""right"">Email: <b></td><td><a href=""mailto:" & rs("email") & """>" & rs("email") & "</a></b></td>"
Response.Write "</tr>"
'Move to the next record
rs.MoveNext
Next
%>
</table>
<br>
<table width="370" border="0" cellspacing="1" cellpadding="1" align="center" height="21" style="font-family: verdana; font-size: 12">
<tr align="center">
<td align="left" width="83">
<%
'If the previous Poll Question Titles page number is higher than page 1 then display a back link
If intRecordPositionPageNum > 1 Then
Response.Write " <a href=""vira_pagina(1).asp?PaginaAtual=" & intRecordPositionPageNum - 1 & """ target=""_self""><< Prev</a>"
End If
%>
</td>
<td width="201">
<%
'If there are more previous Poll Question Titles to display then add a title to the other pages
If intRecordPositionPageNum > 1 or NOT rs.EOF Then
Response.Write " Pagíginas de dados"
End If
%>
</td>
<td align="right" width="76">
<%
'If it is Not the End of the previous Poll Question Titles entries then display a next link for the next previous Poll Question Titles page
If NOT rs.EOF then
Response.Write " <a href=""vira_pagina(1).asp?PaginaAtual=" & intRecordPositionPageNum + 1 & """ target=""_self"">Next >></a>"
End If
'Reset Server Objects
Set adoCon = Nothing
rs.Close
Set rs = Nothing
%>
</td>
</tr>
</table>
[B]'AQUI É ONDE GERA A PAGINAÇÃO, GALERA[/B]
[COLOR=red]<%
For Paginass = 1 to TotalDEPaginas
If Paginass <> request.querystring("PaginaAtual") then
Response.Write "<a href=""vira_pagina(1).asp?PaginaAtual=" & Paginass & """>"
end if
Response.Write " | " & Paginass & " | "
If Paginass <> request.querystring("PaginaAtual") then
Response.write "</a>"
end if
Next
%>[/COLOR]
</div>
</body>
</html>
Pergunta
marcos_804
OLÁ, GALERINHA TUDO BEM? eSTOU AQUI DE VOLTA POIS TO COM UM PROBLEMA MÉDIO.
estou COM UM CÓDIGO DE PAGINAÇÃO, MAS EU QUERIA QUE A PAGINA ATUAL, OU SEJA AQUELA QUE ESTEJA SENDO EXIBIDA FIQUE DESLINKADA OU INATIVA.
TAMBÉM GOSTARIA DE SABER COMO FAÇO PARA EXIBIR APENAS 5 PÁGINAS POR VEZ
ABAIXO VAI O CODIGO
<% Response.Buffer = True %> <% Dim adoCon Dim rs Dim strCon Dim strAccessDB Dim strSQL Dim strPreviousPollQuestion Dim intPreviousPollQuestionID Dim dtmPreviousPollQuestionDate Dim intRecordPositionPageNum Dim intRecordLoopCounter Const intRecordsPerPage = 2 If Request.QueryString("PaginaAtual") = "" Then intRecordPositionPageNum = 1 Else intRecordPositionPageNum = CInt(Request.QueryString("PaginaAtual")) End If %> <html> <head> <title>TESTE DE PAGINAÇÃO</title> <style> a{color:#ff0000;text-decoration:none} a:hover{padding-left:3;color:#336699;text-decoration:underline} </style> </head> <body bgcolor="#ffffff" style="font-family: verdana; font-size: 12"> <div align="center"> <span style="font-family:verdana;font-size:17;font-weight:bold;color:#336699">Teste Do Livro</span> <table width="370" border="0" cellspacing="0" cellpadding="1"> <% strAccessDB = "banco" Set adoCon = Server.CreateObject("ADODB.Connection") Set rs = Server.CreateObject("ADODB.Recordset") 'Abre conexao com o banco de dados strCon="DRIVER={Microsoft Access Driver (*.mdb)};" strCon = strCon & "DBQ=" & Server.MapPath(strAccessDB) strSQL = "SELECT * FROM banco ORDER By id DESC" rs.Open strSQL, strCon, 3 TotalDEGravacoes = rs.RecordCount TotalDePaginas = int(TotalDEGravacoes/intRecordsPerPage) If TotalDEPaginas MOD intRecordsPerPage <> 0 Then TotalDEPaginas = TotalDePaginas + 1 end if rs.PageSize = intRecordsPerPage If NOT rs.EOF Then rs.AbsolutePage = intRecordPositionPageNum For intRecordLoopCounter = 1 to intRecordsPerPage 'If there are no more previous Poll Question records left to display then exit loop If rs.EOF Then Exit For Response.Write "<tr>" Response.Write "<td width=""250"">Nome: <b>" & rs("nome") & "</b></td></tr><tr>" Response.Write "<td width=""120"" align=""right"">Email: <b></td><td><a href=""mailto:" & rs("email") & """>" & rs("email") & "</a></b></td>" Response.Write "</tr>" 'Move to the next record rs.MoveNext Next %> </table> <br> <table width="370" border="0" cellspacing="1" cellpadding="1" align="center" height="21" style="font-family: verdana; font-size: 12"> <tr align="center"> <td align="left" width="83"> <% 'If the previous Poll Question Titles page number is higher than page 1 then display a back link If intRecordPositionPageNum > 1 Then Response.Write " <a href=""vira_pagina(1).asp?PaginaAtual=" & intRecordPositionPageNum - 1 & """ target=""_self""><< Prev</a>" End If %> </td> <td width="201"> <% 'If there are more previous Poll Question Titles to display then add a title to the other pages If intRecordPositionPageNum > 1 or NOT rs.EOF Then Response.Write " Pagíginas de dados" End If %> </td> <td align="right" width="76"> <% 'If it is Not the End of the previous Poll Question Titles entries then display a next link for the next previous Poll Question Titles page If NOT rs.EOF then Response.Write " <a href=""vira_pagina(1).asp?PaginaAtual=" & intRecordPositionPageNum + 1 & """ target=""_self"">Next >></a>" End If 'Reset Server Objects Set adoCon = Nothing rs.Close Set rs = Nothing %> </td> </tr> </table> [B]'AQUI É ONDE GERA A PAGINAÇÃO, GALERA[/B] [COLOR=red]<% For Paginass = 1 to TotalDEPaginas If Paginass <> request.querystring("PaginaAtual") then Response.Write "<a href=""vira_pagina(1).asp?PaginaAtual=" & Paginass & """>" end if Response.Write " | " & Paginass & " | " If Paginass <> request.querystring("PaginaAtual") then Response.write "</a>" end if Next %>[/COLOR] </div> </body> </html>AGRADEÇO DESDE JÁ!!
Link para o comentário
Compartilhar em outros sites
4 respostass a esta questão
Posts Recomendados
Participe da discussão
Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.