print friendly function with asp

Discussion in 'ASP General' started by weiwei, Oct 1, 2004.

  1. weiwei

    weiwei Guest

    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:"
    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

    %>
    '--------------------------------------------------------------------------
     
    weiwei, Oct 1, 2004
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:...
    > HI
    > I am having a problem with print friendly function with asp, I have
    > download some code regard with print friendly,
     
    Ray Costanzo [MVP], Oct 1, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt Mercer

    Print friendly page

    Matt Mercer, Sep 13, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    504
    =?Utf-8?B?SUdvdFlvdXJEb3ROZXQ=?=
    Sep 13, 2004
  2. =?Utf-8?B?QXhmb3Jk?=

    print a user-friendly page?

    =?Utf-8?B?QXhmb3Jk?=, May 15, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    500
    =?Utf-8?B?QXhmb3Jk?=
    Jun 2, 2006
  3. howa
    Replies:
    2
    Views:
    352
    Jim Langston
    Apr 22, 2008
  4. Mike
    Replies:
    1
    Views:
    1,137
    Andrew Morton
    Feb 11, 2009
  5. techy techno
    Replies:
    10
    Views:
    867
    Jeff Cochran
    Jan 21, 2004
Loading...

Share This Page