pagination classic asp, and button changed to hyperlinks
I've created buttons that have been edited with css to look like hyperlinks so I can use form post instead of using querystring. I've made it so t开发者_运维问答hat when a button is clicked it creates a checkbox for each user. I want it so that when i change the state of the checkbox I want it to save as I'm going through different letters. I believe the problem I am having is because the "hyperlinks" are really buttons and changing the checked state of a checkbox is creating problems. I would prefer not to use JavaScript but if its the only way for me to get the results that I want then I would use java-script. Code provided below -
<form action="Table.asp" method="post" name="form2">
<input type="submit" name="Button" value="#" style="background:transparent;border:0;display:inline;color:#00F;text-decoration:underline;padding:0px;cursor:pointer">
<% for i = 97 to 122 %>
<input type="submit" name="Button" value="<%=CHR(i) %>" style="background:transparent;border:0;display:inline;color:#00F;text-decoration:underline;padding:0px;cursor:pointer;">
<% next %>
</br></br></br>
<%
alphaB = request.form("Button")
if alphaB <>"" then
%>
<input type="checkbox" name="checkBox" value="<%=alphaB %>" <%=session("checkBox") %>>
<%
response.write alphaB
end if
alphaCheck = request.form("checkBox")
if alphaCheck <>"" then
session("checkBox") = "checked"
else
session("checkBox") = ""
end if
all you got wrong is the place where you set your session ...
move
alphaCheck = request.form("checkBox")
if alphaCheck <>"" then
session("checkBox_"&alphaCheck) = "checked"
else
session("checkBox_"&alphaCheck) = ""
end if
...
<input type="checkbox" name="checkBox" value="<%=alphaB %>" <%=session("checkbox_"&alphaB ) %>/>
before the checkbox creation
what happen is that on the first time your session is not initialized once you hit the page
<!--#include file="session_check.asp"-->
<!--#include file="connection.asp"-->
<%
' Last updated by Arun Sharma
' last updation pourpos mintain the paging of POP closed calls
' last updated on 6th sep. 2007`enter code here`
%>
<%
if session("type1")=0 and session("type2") =0 then
response.redirect "Default.asp"
end if
%>
<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>view</title>
</head>
<body>
<%
If session("type") ="sa" Then
%>
<p><!--#include file="header_sa.asp"--></p>
<%
else
%><p><!--#include file="header_a.asp"--></p><%
End If
%>
<!--
<table width="100%" style="border-left-width: 0; border-top-width: 0; border-bottom-width: 0">
<tr>
<td width="24%" bgcolor="#FFFFFF" style="border-top:medium none #111111; border-bottom:medium none #111111; border-left-style:none; border-left-width:medium; border-right-style:none; border-right-width:medium" height="25">
<center> <img border="0" height=90 width=312 src="images/tulipconnect12.jpg"> </center> </td>
</tr>
</table>
<table width="100%" style="border-collapse: collapse" bordercolor="#FFCC99" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" style="border-style: solid; border-width: 1" align="center" bordercolor="#FFFFFF" bgcolor="#F37D7D">
<b><font color="#FFFFFF"> </font>
<font color="#006699" face="Verdana" size="2">
<a style="color: #FFFFFF" href="view_list.asp">Home</a></font></b></td>
<td width="20%" bgcolor="#F37D7D" style="border-style: solid; border-width: 1" align="center" bordercolor="#FFFFFF">
<p align="center"><b> <font face="Verdana" size="2" color="#FFFFFF"> View-Calls</font></b></td>
<td width="20%" style="border-style: solid; border-width: 1" align="center" bordercolor="#FFFFFF" bgcolor="#F37D7D">
<b><font color="#FFFFFF">
</font>
<font face="Verdana" color="#FF6600">
<a href="changepassword.asp"><font size="2" color="#FFFFFF">Change</font></a></font><font face="Verdana"><font size="2"><a style="color: #FFFFFF" href="changepassword.asp">
Password</a></font><font color="#FF6600"><a href="changepassword.asp"><font size="2" color="#FFFFFF">
</font> </a>
</font></font></b></td>
<td width="20%" bgcolor="#F37D7D" style="border-style: solid; border-width: 1" align="center" bordercolor="#FFFFFF">
<p align="center">
<b>
<font color="#FFFFFF"> <font face="Verdana" size="2"> <a href="down.ASP">
<font color="#FFFFFF">Downtime Report</font></a></font></font></b></td>
<td width="20%" bgcolor="#F37D7D" style="border-style: solid; border-width: 1" align="center" bordercolor="#FFFFFF">
<p align="center">
<b>
<font color="#FFFFFF"> <font face="Verdana" size="2"> <a href="LOGOUT.ASP">
<font color="#FFFFFF">Logout</font></a></font></font></b></td>
</tr>
</table>
-->
<%
if session("type1") =1 then
end if
%>
<center>
<font color="#F37D7D" face="Georgia, Times New Roman, Times, serif" size="4"> </font><font color="#FF3300" face="Georgia, Times New Roman, Times, serif" size="3"><b>Circuit Closed Calls</b></font>
</center>
<%
dim name
pno=request.querystring("page")
name= request.form("engineer")
if pno="" then
pno=0
end if
' set con =server.createobject("ADODB.CONNECTION")
set rs=server.createobject("ADODB.RECORDSET")
' con.open "Provider=SQLOLEDB; Data Source = database.tulipconnect.com\CALLMANAGER1; Initial Catalog = support; User Id = app; Password=App_access_2009"
sql="select Fault_Ticket_Num,Organisation,Link_Location,Fault_Detail,dDate,tTime,cldate,Assigned_To from Call_Login where Call_Status <> 'OPEN' and region='"&session("region")&"' order by dDate desc"
rs.open sql,con
%>
<table height="90%" align="center">
<tr>
<td valign="top">
<table width="95%" height="70" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFCC99" style="border-collapse: collapse">
<tr bordercolor="FF3333" bgcolor="FF3333">
<td width="6%" height="56" align="center" style="border-style: solid; border-width: 1"><b><font face="Verdana" color="#FFFFFF" size="2">Call history</font></b></td>
<td width="13%" height="56" align="center" style="border-style: solid; border-width: 1"><font color="#FFFFFF" face="Verdana" size="2"><b>Fault Ticket Number</b></font></td>
<td width="9%" height="56" align="center" style="border-style: solid; border-width: 1"><b><font color="#ffffff" face="Verdana" size="2">Organization</font></b></td>
<td width="8%" height="56" align="center" style="border-style: solid; border-width: 1" ><b><font color="#FFFFFF" face="Verdana" size="2"> Location</font></b></td>
<td width="25%" height="56" align="center" style="border-style: solid; border-width: 1"><b><font color="#ffffff" face="Verdana" size="2">Fault Details </font> </b> </td>
<td width="10%" height="56" align="center" style="border-style: solid; border-width: 1" ><b><font face="Verdana" color="#FFFFFF" size="2">Call Status</font></b></td>
<td width="8%" height="56" align="center" style="border-style: solid; border-width: 1" ><b><font face="Verdana" color="#FFFFFF" size="2">Assigned To</font></b></td>
<td width="10%" height="56" align="center" style="border-style: solid; border-width: 1" ><b><font color="#FFFFFF" face="Verdana" size="2">Opening Date</font></b></td>
<td width="10%" height="56" align="center" style="border-style: solid; border-width: 1" ><b><font color="#FFFFFF" face="Verdana" size="2">Closing Date</font></b></td>
</tr>
<%
If rs.eof Then
response.write("No call for this user")
response.End
End if
rs.move(10*pno)
rno=0
while not rs.eof and rno<10
rno=rno+1
%>
<tr>
<td width="6%" style="border-style: solid; border-width: 1" bordercolor="#F37D7D" bgcolor="#F9EFF6" height="15"><center>
<a href=fault_history.asp?reportid=<%=rs("Fault_Ticket_Num")%>&assignto=<%=rs("Assigned_To")%>> <img border="0" src="images/right_arrow.gif" width="13" height="13"></a>
</center></td>
<td width="12%" style="border-style: solid; border-width: 1" align="center" bgcolor="#F9EFF6" bordercolor="#F37D7D" height="15"><font color="blue" face="verdana" size=2><%=rs("Fault_Ticket_Num")%></font></td>
<td width="9%" style="border-style: solid; border-width: 1" align="center" bgcolor="#F9EFF6" bordercolor="#F37D7D" height="15"><font color="blue" face="verdana" size=2><%=rs("Organisation")%></font></td>
<td width="8%" style="border-style: solid; border-width: 1" align="center" bgcolor="#F9EFF6" bordercolor="#F37D7D" height="15"><font color="blue" face="verdana" size=2><%=rs("Link_Location")%></font></td>
<td width="25%" style="border-style: solid; border-width: 1" align="center" bgcolor="#F9EFF6" bordercolor="#F37D7D" height="15"><font color="blue" face="verdana" size=2><%=rs("Fault_Detail")%></font><font color="blue" face="verdana"> </font></td>
<td width="10%" style="border-style: solid; border-width: 1" align="center" bgcolor="#F9EFF6" bordercolor="#F37D7D" height="15"><font color="blue" face="verdana" size=2>
<% response.write("Call Closed")%>
</font><font color="blue" face="verdana"> </font> </td>
<td width="8%" style="border-style: solid; border-width: 1" align="center" bgcolor="#F9EFF6" bordercolor="#F37D7D" height="15"> <font color="blue" face="verdana" size=2><%=rs("Assigned_To")%></font><font color="blue" face="verdana"> </font></td>
<td width="10%" style="border-style: solid; border-width: 1" align="center" bgcolor="#F9EFF6" bordercolor="#F37D7D" height="15"><font color="blue" face="verdana" size=2><%=rs("dDate")%></font></td>
<td width="10%" style="border-style: solid; border-width: 1" align="center" bgcolor="#F9EFF6" bordercolor="#F37D7D" height="15"><font color="blue" face="verdana" size=2><%=rs("clDate")%></font></td>
</tr>
<% rs.movenext
wend
%>
<tr>
<td width="20%" style="border-style: solid; border-width: 1" align="center" bgcolor="#F9EFF6" bordercolor="white" height="15" colspan="7">
<p align="left">
<a style="color: #663399; font-family:verdana; font-size:12px" href="view_close.asp?D1=<%=oth%>&page=<%response.write(0)%>">First</a>
<font color="#F37D7D">
<% if pno>0 then
%>
</font>
<a style="color: #663399; font-family:verdana; font-size:12px" href="view_close.asp?D1=<%=oth%>&page=<%response.write(pno-1)%>">Previous</a><font color="#F37D7D">
<% end if %>
<%
if rno=10 Then
pno=pno+1
%>
</font> <a style="color:#663399; font-family:verdana; font-size:12px" href="view_close.asp?D1=<%=oth%>&page=<%response.write(pno)%>">Next</a><font color="#F37D7D">
<% end if%>
</font></p></td>
<td width="20%" style="border-style: solid; border-width: 1" align="center" bgcolor="#F9EFF6" bordercolor="white" height="15" colspan="2"><p><a href="view_open_excel.asp"><font color="black" size="2">MOVE TO EXCEL</font></a> </p></td>
</tr>
</table>
</form>
<%
pno1=request.querystring("page1")
%>
<center>
<p><font color="#F37D7D" face="Georgia, Times New Roman, Times, serif" size="4"> </font><font color="#FF3300" face="Georgia, Times New Roman, Times, serif" size="3"><b>POP Closed Call</b></font></p>
</center>
<%
Set rs_pop =server.CreateObject("adodb.recordset")
sql_pop_calls="Select distinct(location_b),call_status,fault_detail,ddate,cldate from call_login where pop_call='Y' and call_status='CLOSE' group by location_b,circuit_id,fault_detail,ddate,call_status,cldate"
'response.write(sql_pop_calls)
rs_pop.open sql_pop_calls ,con %>
<table width="95%" height="70" border="1" align="center" cellpadding="2" cellspacing="0" bordercolor="#FF3300" bgcolor="#FFF0F4" style="border-collapse: collapse">
<tr bgcolor="FF3333">
<td width="5%" height="40" bordercolor="#EED5D5" style="border-style: none; border-width: 1">
<b><font face="Verdana" color="#FFFFFF" size="2">S.NO.</font></b></td>
<td width="10%" height="40" bordercolor="#EED5D5" style="border-style: none; border-width: 1">
<b><font face="Verdana" color="#FFFFFF" size="2">POP Name</font></b></td>
<td width="19%" height="40" align="left" bordercolor="#EED5D5" style="border-style: none; border-width: 1">
<font color="#FFFFFF" face="Verdana" size="2"><b>Fault Details</b></font></td>
<td width="15%" height="40" align="left" bordercolor="#EED5D5" style="border-style: none; border-width: 1">
<b><font color="#FFFFFF" face="Verdana" size="2">Opening Date</font></b></td>
<td width="15%" height="40" align="left" bordercolor="#EED5D5" style="border-style: none; border-width: 1">
<b><font color="#FFFFFF" face="Verdana" size="2">Closing Date</font></b></td>
<td width="13%" height="40" align="left" bordercolor="#EED5D5" style="border-style: none; border-width:1" >
<b><font color="#FFFFFF" face="Verdana" size="2">No. of Affected Circuits</font></b></td>
</tr>
<%
if pno1="" then
pno1=1
end if
if pno1=1 then
sno=0
else
sno=(pno1-1)*10
end if
rs_pop.move(10*pno1)
rno=0
'sno=0
if not rs_pop.eof then
do while not rs_pop.eof and rno<10
rno=rno+1
sno=sno+1
%>
<tr>
<td align="center"><font color="blue" face="Verdana, Arial, Helvetica, sans-serif" size="2">
<%=sno%></font> </td>
<td>
<font color="blue" face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=rs_pop("location_b")%></font> </td>
<td><font color="blue" face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=rs_pop("fault_detail")%></font></td>
<td><font color="blue" face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=rs_pop("ddate")%><%'=rs_pop("ddate")%></font></td>
<td><font color="blue" face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=rs_pop("cldate")%><%'=rs_pop("ddate")%></font></td>
<td>
<%
set rs_count_fault=server.CreateObject("adodb.recordset")
sql_count_fault="select count(circuit_id) as no_of_faults from call_login where ddate='"&rs_pop("ddate")&"' and pop_call='Y' and call_status='CLOSE' and location_b='"&rs_pop("location_b")&"' group by location_b "
'response.Write(sql_count_fault)
rs_count_fault.open sql_count_fault,con
if not rs_count_fault.eof then %>
<a href="#" onClick="javascript:imgB('pop_call_effected_cir_list.asp?pop_name=<%=rs_pop("location_b")%>&call_status=<%=rs_pop("call_status")%>&d_date=<%=rs_pop("ddate")%>')" title="View Affected Circuits">
<font color="blue" face="Verdana, Arial, Helvetica, sans-serif" size="2"><%=rs_count_fault("no_of_faults")%></font></a>
<%
end if
%> </td>
</tr>
<% rs_pop.movenext
loop
else
%>
<tr><td colspan="6"><font color="#000099" face="Verdana, Arial, Helvetica, sans-serif" size="1"><b>No Open Calls </b></font></td></tr>
<%
end if
%>
<tr><td width="20%" style="border-style: solid; border-width: 1" align="center" bgcolor="#F9EFF6" bordercolor="white" height="15" colspan="7">
<p align="left"><a style="color: #663399; font-family:verdana; font-size:12px" href="view_close.asp?page1=<%response.write(1)%>">First</a><font color="#F37D7D">
<% if pno1>1 then
%>
</font>
<a style="color: #663399; font-family:verdana; font-size:12px" href="view_close.asp?page1=<%response.write(pno1-1)%>">Previous</a><font color="#F37D7D">
<% end if %>
<%
if rno=10 Then
pno1=pno1+1
%>
</font>
<a style="color: #663399; font-family:verdana; font-size:12px" href="view_close.asp?page1=<%response.write(pno1)%>">Next</a><font color="#F37D7D">
<% end if%></font></p></td></tr>
</table>
<br>
</td>
</tr>
</table>
<!--#include file="footer.asp"-->
<script>
function imgB(useridVal)
{
urlImg=useridVal;
nwin1 = window.open(urlImg,"imgB","toolbar=no,directories=no, scrollbars=1, resizable=1,menubar=no,location=no,maximize=yes,width=450,height=230");
}
function boxes()
{
if(f1.C2.checked==true)
{
for(i=0;i<f1.C1.length;i++)
document.f1.C1[i].checked=true
}
if(f1.C2.checked==false)
{
for(i=0;i<f1.C1.length;i++)
document.f1.C1[i].checked=false
}
}
function Delete()
{
if(confirm("Are you sure"))
return true
else
return false
}
</script>
</font> </p>
</body>
</html>
精彩评论