Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Oi pessoal tudo bem
Gostaria de tirar minha duvida se é possível ou não fazer isso no ASP Classico...
Seguinte, gostaria de fazer minha paginação de acordo com o campo de pesquisa, pois na hora de clicar na paginação o campo de pesquisa se apaga no postback ... e por isso a paginação fica enorme desfaz a pesquisa com aquele dado informado ....
Como posso resolver isso porque também programo no .net e isso não acontece ....
Eis o código da pagina ASP:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Dim sqlCustomers,rsCustomers
Dim con, rst, oConnection, cmd, conexaoDataBase,temp,temp2
Set conexaoDataBase= Server.CreateObject("ADODB.Connection")
conexaoDataBase.Open "Provider=SQLNCLI10; Data Source=10.1.1.3; Initial Catalog=Northwind; User ID=sa; Password=root"
Set rsCustomers = Server.CreateObject("ADODB.RecordSet")
rsCustomers.Pagesize = 3
if (request.form("txtContactName") <> "") then
valorString = Request.Form("txtContactName")
end if
rsCustomers.open "SELECT * FROM CUSTOMERS WHERE ContactName LIKE '%" +valorString+"%' order by ContactName asc", conexaoDataBase,1,3
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http:// www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="yui-datatable.css"/>
<link rel="stylesheet" type="text/css" href="tablecloth.css"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<br />
<br /> <tr>
<td width="637" class="style3">
<form method="post">
<table border="0" cellspacing="0" cellpadding="0" style="width: 673px">
<tr>
<td width="352"><input name="txtContactName" id="txtContactName" type="text" size="70" maxlength="90" autocomplete="off" /></td>
<td width="352"><input name="buton" type="submit" value="Pesquisar"></td>
</tr>
</table>
</form>
<br />
<br />
<table align=center border="0" >
<tr>
<%for j = 1 to rsCustomers.PageCount %>
<td width=5><a href="Simple.asp?pag=<%= j %>"><%= j %></a></td>
<%next%>
</tr>
</table>
<TABLE class="yui-datatable-theme" cellspacing="0" cellpadding="0">
<TH>CustomerID</TH>
<TH>CompanyName</TH>
<TH>ContactName</TH>
<TH>ContactTitle</TH>
<TH>Address</TH>
<TH>City</TH>
<TH>Region</TH>
<TH>PostalCode</TH>
<TH>Country</TH>
<TH>Phone</TH>
<TH>Fax</TH>
<TH>Editar</TH>
<TH>Excluir</TH>if Request.QueryString("pag") = "" then
rsCustomers.AbsolutePage = 1
else
rsCustomers.AbsolutePage = CInt(Request.QueryString("pag"))
end if
while (i < rsCustomers.PageSize) and not (rsCustomers.EOF)
i = i + 1
if cor = "#eeeeee" then
cor = "#ffffff"
else
cor = "#eeeeee"
end if
%>
<TR>
<TD> <%= rsCustomers("CustomerID") %> </TD>
<TD><%= rsCustomers("CompanyName") %> </TD>
<TD><%= rsCustomers("ContactName") %> </TD>
<TD><%= rsCustomers("ContactTitle") %> </TD>
<TD><%= rsCustomers("Address") %> </TD>
<TD><%= rsCustomers("City") %></TD>
<TD><%= rsCustomers("Region") %></TD>
<TD><%= rsCustomers("PostalCode") %></TD>
<TD><%= rsCustomers("Country") %></TD>
<TD><%= rsCustomers("Phone") %> </TD>
<TD><%= rsCustomers("Fax") %> </TD>
<td align=center><a href="SimpleEdit.asp?CustomerID=<%=rsCustomers("CustomerID")%>"><img src="/imagens/Edt.gif" border="0"></a></td>
<td align=center><a href="Contato_Exclui.asp?cod=<%= rsCustomers("CustomerID") %>"><img src="/imagens/del.gif" border="0"></a></td>
</TR><tr>
<td colspan="13" align="center" bgcolor="#FFCC99">Não há registros cadastrados</td>
</tr></table>
</body>
</html>
Se poderem me ajudar tenho a certeza que é duvidas de muitos que estam comesando no ASP Classico...
Com todo respeito a comunidade.
Aguardo retorno
Carregando comentários...