By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,300 Members | 2,044 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,300 IT Pros & Developers. It's quick & easy.

print friendly function with asp

P: n/a
HI
I am having a problem with print friendly function with asp, I have
download some code regard with print friendly,
it works fine with static html information, however, I have the
dynamic pages and strange things is everything works
except I cannt see the result of query from database.

anyone has idea, please help me out, thanks in advance.

below is the code I have, there are several pages of code and I have
break down,
'---------------------------------------------------------------------------------
testresult.asp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
strlname = Trim(request.form("lastname"))
strfname = Trim(request.form("firstname"))
%>
<!--#include file="includes/connection.inc"-->
<%
' Recordset Object
Dim rs
Set rs = Server.CreateObject("ADODB.Recordset")

' opening connection
rs.Open "select * from genlist " & _
"Where Lname like '%" & strlname & "%' and Fname like '%" & strfname &
"%'", connStr, 3, 4
%>

<html>
<head>
<title>Phone Directory</title>
<meta name="Microsoft Border" content="tb">

<LINK href="css.css" rel="stylesheet" type="text/css">
</head>

<body bgcolor="#FFFFFF">
<!-- noprint -->

<table border="0" cellpadding="0" cellspacing="0"
width="100%"><tr><td>
<img src="../image/welcome1.jpg" width="300" height="20">
<table width="804" cellpadding="0" cellspacing="0" border="0">
<tr>
<td> <img src="../image/banner2.jpg" width="803" height="70"></td>
</tr>
</table>
<table width="803" cellpadding="3" cellspacing="1" border="0">
<tr bgcolor="#436EEE">
<td height="22" align="center"><font size="2" face="Arial,
Helvetica, sans-serif"><a class="one" href="../school/index.htm"
style="text-decoration: none">schools</a></font></td>
<td align="center"><font size="2" face="Arial, Helvetica,
sans-serif"><a class="one" href="../districtinformation/index.htm"
style="text-decoration: none">district
information</a></font></td>
<td align="center"><font size="2" face="Arial, Helvetica,
sans-serif"><a class="one" href="../parentresources/index.htm"
style="text-decoration: none">parent
resources</a></font></td>
<td align="center"><font size="2" face="Arial, Helvetica,
sans-serif"><a class="one" href="../superindendent/index.htm"
style="text-decoration: none">superintendent</a></font></td>
<td align="center"><font size="2" face="Arial, Helvetica,
sans-serif"><a class="one" href="../boardofeducation/index.htm"
style="text-decoration: none">board
of education</a></font></td>
<td align="center"><font size="2" face="Arial, Helvetica,
sans-serif"><a class="one" href="../academics/index.htm"
style="text-decoration: none">academics</a></font></td>
<td align="center"><font size="2" face="Arial, Helvetica,
sans-serif"><a class="one" href="../departments/index.htm"
style="text-decoration: none">departments</a></font></td>
<td align="center"><font size="2" face="Arial, Helvetica,
sans-serif"><a class="one" href="../humanresources/index.htm"
style="text-decoration: none">employment</a></font></td>
</tr>
</table>
</td></tr></table><table border="0" cellpadding="0" cellspacing="0"
width="100%"><tr>
<td height="335" valign="top">
<table width="804" height="316" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td width="240" valign="top"><table width="100%" border="0"
cellspacing="0" cellpadding="0">
<tr>
<td>&nbsp;</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td width="14%">&nbsp;</td>
<td width="75%"><table width="100%" border="0"
cellspacing="0" cellpadding="0">
<tr>
<td><font size="2" face="Arial, Helvetica,
sans-serif"><a class="two" href="index.htm" style="text-decoration:
none">Phone
Directory Home</a></font></td>
</tr>
<tr>
<td><font size="2" face="Arial, Helvetica,
sans-serif"><a class="two" href="search.asp" style="text-decoration:
none">Search
Phone Directory</a></font></td>
</tr>
<tr>
<td><font size="2" face="Arial, Helvetica,
sans-serif">&nbsp;</font></td>
</tr>
<tr>
<td><font size="2" face="Arial, Helvetica,
sans-serif">&nbsp;</font></td>
</tr>
<tr>
<td><font size="2" face="Arial, Helvetica,
sans-serif">&nbsp;</font></td>
</tr>
<tr>
<td><font size="2" face="Arial, Helvetica,
sans-serif">&nbsp;</font></td>
</tr>
<tr>
<td><font size="2" face="Arial, Helvetica,
sans-serif">&nbsp;</font></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td height="16">&nbsp;</td>
</tr>
</table></td>
<td width="11%">&nbsp;</td>
</tr>
</table></td>
<td width="11" valign="middle"><img
src="../image/vertical1.jpg" width="10" height="249"></td>
<td width="553" valign="top"><table width="100%" border="0"
cellspacing="0" cellpadding="0">
<tr>
<td>&nbsp;</td>
</tr>
</table><!-- /noprint -->
<table width="100%" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td>
<!-- #include file="printlink.asp" -->
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td><font color="#0000FF" size="2" face="Arial, Helvetica,
sans-serif">Last Name </font></td>
<td><font color="#0000FF" size="2" face="Arial, Helvetica,
sans-serif">First Name </font></td>
<td><font color="#0000FF" size="2" face="Arial, Helvetica,
sans-serif">Phone</font></td>
<td><font color="#0000FF" size="2" face="Arial, Helvetica,
sans-serif">Phone Ext</font></td>
<td><font color="#0000FF" size="2" face="Arial, Helvetica,
sans-serif">Department</font></td>
</tr>
<% If Not rs.EOF Then %>
<% Do While Not rs.EOF %>
<tr>
<td><% response.write "<p class=""speciallink"">"& rs("Lname")
%></td>
<td><% response.write "<p class=""speciallink"">"& rs("Fname")
%></td>
<td><% response.write "<p class=""speciallink"">"&
rs("Phone_Num") %></td>
<td><% response.write "<p class=""speciallink"">"& rs("Phone_Ext")
%></td>
<td><% response.write "<p class=""speciallink"">"&
rs("Location_name") %></td>
<% rs.MoveNext %>
<% loop %>
<% Else %>
<% Response.redirect "wrong.asp" %>
<% End If %>
<%
rs.Close
Set rs = Nothing
%>
</table>
</td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
</table>

</td>
</tr></table>

<!-- noprint -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td>
<table width="803" cellpadding="4" cellspacing="0" border="0">
<tr bgcolor="#556B99">
<td width="563"><font color="#FFFFFF" size="1" face="Arial,
Helvetica, sans-serif">St.
Louis Public Schools - 801 N. 11th Street - St.Louis - MO
- 63101 - 314/231-3720</font></td>
<td width="224" align="right"><font color="FFFFFF" size="1"
face="Arial, Helvetica, sans-serif"><a class="one" href="../index.htm"
style="text-decoration: none">Home</a>&nbsp;&nbsp;&nbsp;
<a class="one" href="mailto:up*****@slps.org"
style="text-decoration: none">Contact</a>&nbsp;</font><font
color="#FFFFFF">&nbsp;&nbsp;</font></td>
</tr>
</table>
</td></tr></table>
<br>
<p>&nbsp;</p>
<!-- /noprint -->
</body>
</html>
'----------------------------------------------------------
printlink.asp
<!-- noprint -->
<%
aURL=request.serverVariables("PATH_INFO")
pDom=request.servervariables("HOST")
pPath=pDom&aUrl
%>
<table border="0" cellpadding="0" style="border-collapse: collapse"
bordercolor="#111111" cellspacing="0">
<tr><td>
<a href="print.asp?page=<%=pPath%>">
<img border="0" src="printl1.gif"></a></td>
<td><p align="left"><font face="Verdana" size="1">
<a href="print.asp?page=<%=pPath%>">Click Here for a Print Friendly
Version</a></font>
</td></tr></table>
<!-- /noprint -->
'------------------------------------------------------
print.asp
<%
Dim page, text, filesys
page = request.querystring("page")

Sub ReplaceTxt(what,door)

Dim regularExpressionObject
Set RegularExpressionObject = New RegExp

With RegularExpressionObject
.Pattern = what
.IgnoreCase = True
.Global = True
End With

text = RegularExpressionObject.Replace(text,door)
Set RegularExpressionObject = nothing
End Sub

'opening the page
Set FileSys = server.createobject("scripting.FileSystemObject")
text = filesys.openTextfile(server.mappath(page)).readall
call replacetxt("<!-- noprint -->","<!--")
call replacetxt("<!-- /noprint -->"," -->")

'writing the text-only version
response.write "<font size='2' face='arial'><b>Printer Friendly
Version</b></font><br><hr noshade color='#000000' size='1'>"
response.write text

%>
'--------------------------------------------------------------------------
Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
This post is way too long to read. Can you trim out all the irrelevant text
and try to narrow things down a bit for us, please?

Ray at work

"weiwei" <We*******@slps.org> wrote in message
news:d3**************************@posting.google.c om...
HI
I am having a problem with print friendly function with asp, I have
download some code regard with print friendly,

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.