以Web表单打印所有面板 [英] Printing all panels in web form

查看:81
本文介绍了以Web表单打印所有面板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网页表单,它有不同的控件。我想使用面板控件来在用户点击打印时打印面板中的控件。如何在我的代码中添加更多面板进行打印?面板控制也能打印表吗?



第一个代码是HTML标记:



I have a web form that has different controls on it. I want to use a panel control for when a user clicks print the controls in the panel will be printed. How can i add more panels to print within my code? Can the panel control also print tables?

The first code is the HTML Markup:

<%@ Page Language="C#" AutoEventWireup="True" Inherits="FinancialProfileFormA" Codebehind="FinancialProfileFormA.aspx.cs" %>

<!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  runat="server">
    <title></title>
    <style type="text/css">
        .style1
        {
            font-size: x-large;
            text-align: center;
        }
        .style2
        {
            width: 100%;
        }
        .style5
        {
            width: 20px;
        }
        .style7
        {
            width: 495px;
            font-weight: bold;
        }
        .style9
        {
            width: 20px;
            height: 23px;
        }
        .style10
        {
            width: 495px;
            height: 23px;
            font-weight: bold;
        }
        .style11
        {
            height: 23px;
        }
        .style18
        {
            font-weight: bold;
        }
        .style19
        {
            width: 905px;
            text-align: center;
        }
        .style21
        {
            width: 212px;
            font-weight: bold;
        }
        .style22
        {
            width: 212px;
            height: 23px;
            font-weight: bold;
        }
        .style23
        {
            font-size: small;
        }
        .style24
        {
            font-size: small;
            font-weight: normal;
        }
        .newStyle1
        {
        }
        .style3
        {
            width: 100%;
        }
        .style35
        {
            width: 469px;
            font-weight: bold;
            font-size: large;
        }
        .style36
        {
            width: 469px;
        }
        .style37
        {
            font-size: large;
            width: 439px;
        }
        .style38
        {
            font-size: x-large;
            width: 200px;
        }
        .style40
        {
            width: 645px;
            height: 23px;
            text-align: right;
        }
        .style41
        {
            width: 645px;
            height: 23px;
            font-weight: bold;
            text-align: right;
        }
        .style42
        {
            height: 23px;
            width: 190px;
        }
        .style47
        {
            font-size: large;
            text-align: center;
        }
        .style48
        {
            font-size: xx-large;
        }
        .style49
        {
            font-size: x-large;
        }
        .style50
        {
            width: 585px;
            height: 137px;
        }
        .style51
        {
            font-weight: bold;
            font-size: x-large;
            text-align: center;
        }
        .style52
        {
            width: 670px;
        }
        .style53
        {
            width: 495px;
        }
        .style54
        {
            width: 212px;
        }
        .style55
        {
            font-size: x-large;
            width: 212px;
            text-align: center;
        }
        .style56
        {
            font-weight: bold;
            font-size: large;
            text-align: center;
        }
        .style57
        {
            width: 200px;
        }
    </style>
    <script language="javascript" type="text/javascript">
// <![CDATA[

        function Reset1_onclick() {

        }

// 
    </script>
</head>
<body background="Images/bkg-blu.jpg" bgcolor="#3399ff">
    <form id="form1"  runat="server">
    <div class="style1">
    
        <div style="text-align: left">
                                                                                                                     <table 

                class="style2">
                <tr>
                    <td style="text-align: center">
                        <img class="style50" src="Images/buildout_header.jpg" /></td>
                </tr>
            </table>
                                                                           
                                                                                                                                      
                                                                    
        </div>
    
        
        <span class="style48">
        <br />
        Financial Profile </span></div>
    <br />
                
    <asp:TextBox ID="TextBoxaccessLevel" runat="server" style="text-align: center" 

        Visible="False"></asp:TextBox>
                
    <br />
    <asp:TextBox ID="TextBoxINST_ID" runat="server" Enabled="False" ReadOnly="True" 

        Visible="False"></asp:TextBox>
    <br />
    <table class="style2">
        <tr>
            <td style="text-align: center">
                <asp:Label ID="lblSchool" runat="server" CssClass="style51"></asp:Label>
            </td>
        </tr>
    </table>
    <table class="style2">
        <tr>
            <td class="style52" style="text-align: right">
                <asp:Label ID="lblCity" runat="server" CssClass="style56"></asp:Label>
                ,</td>
            <td>
 <asp:Label ID="lblState" runat="server" CssClass="style56"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="style52" style="text-align: right">
                 </td>
            <td style="text-align: right">
                <asp:Label ID="lblDate" runat="server" style="font-weight: 700" 

                    Text="Today's Date"></asp:Label>
 
                <asp:TextBox ID="TextBoxDATE" runat="server" 

                    style="font-weight: 700; text-align: center" Width="180px" Enabled="False" 

                    ReadOnly="True"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style52" style="text-align: right">
                 </td>
            <td style="text-align: right">
                <asp:Label ID="lblTime" runat="server" style="font-weight: 700"></asp:Label>
            </td>
        </tr>
    </table>
    <br />
    <br />
    <br />
    <table class="style2">
        <tr>
            <td class="style5">
                 </td>
            <td class="style53">
                 </td>
            <td class="style55">
                <asp:Label ID="lblLYEAR" runat="server" style="font-weight: 700"></asp:Label>
            </td>
            <td>
                <span class="style49">           
                <asp:Label ID="lblYEAR" runat="server" style="text-align: center">2013</asp:Label>
                </span></td>
        </tr>
        <tr>
            <td class="style5">
                 </td>
            <td class="style53">
                                            Total Revenues and Other Additions <span class="style23">(IPEDS 
                Part B, Line 25)</span></td>
            <td class="style54">
                <asp:TextBox ID="TextBoxLYTROA" runat="server" style="text-align: left" 

                    Width="180px" ToolTip="IPEDS Part B, line 25" Enabled="False" 

                    ReadOnly="True"></asp:TextBox>
                </td>
            <td>
                <asp:TextBox ID="TextBoxTROA" runat="server" style="text-align: left" 

                    Width="180px" ToolTip="IPEDS Part B, line 25">0</asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator16" runat="server" 

                    ControlToValidate="TextBoxTROA" 

                    ErrorMessage="Please Enter Total Revenues and Other Additions" 

                    ForeColor="Red" CssClass="style18"></asp:RequiredFieldValidator>
                </td>
        </tr>
    </table>
    <br />
    <br />
    <table class="style2">
        <tr>
            <td class="style5">
                1</td>
            <td class="style7">
                Instruction <span class="style24">(IPEDS Part C, Line 01, Column 01)</span></td>
            <td class="style21">
                <asp:TextBox ID="TextBoxLYInstr" runat="server" Enabled="False" 

                    Width="180px"></asp:TextBox>
            </td>
            <td>
                <asp:TextBox ID="TextBoxInstr" runat="server" Width="180px" 

                    ToolTip="IPEDS Part C, Line 01, Column 01">0</asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator17" runat="server" 

                    ControlToValidate="TextBoxInstr" ErrorMessage="You Must Enter Instruction!!!" 

                    ForeColor="Red" CssClass="style18"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style9">
                2</td>
            <td class="style10">
                Research <span class="style24">(IPEDS Part C, Line 01, Column 01)</span></td>
            <td class="style22">
                <asp:TextBox ID="TextBoxLYRes" runat="server" Enabled="False" ReadOnly="True" 

                    Width="180px"></asp:TextBox>
            </td>
            <td class="style11">
                <asp:TextBox ID="TextBoxRes" runat="server" Width="180px" 

                    ToolTip="IPEDS Part C, Line 02, Column 01">0</asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator19" runat="server" 

                    ControlToValidate="TextBoxRes" ErrorMessage="You Must Enter Research!!!" 

                    ForeColor="Red" CssClass="style18"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style5">
                3</td>
            <td class="style7">
                Public Service<span class="style24"> (IPEDS Part C, Line 01, Column 01)</span></td>
            <td class="style21">
                <asp:TextBox ID="TextBoxLYPubS" runat="server" Enabled="False" ReadOnly="True" 

                    Width="180px"></asp:TextBox>
            </td>
            <td>
                <asp:TextBox ID="TextBoxPubS" runat="server" Width="180px" 

                    ToolTip="IPEDS Part C, Line 03, Column 01">0</asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator20" runat="server" 

                    ControlToValidate="TextBoxPubS" ErrorMessage="You Must Enter Public Service!!!" 

                    ForeColor="Red" CssClass="style18"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style5">
                4</td>
            <td class="style7">
                Academic Support<span class="style24"> (IPEDS Part C, Line 01, Column 01)</span></td>
            <td class="style21">
                <asp:TextBox ID="TextBoxLYAcad" runat="server" Enabled="False" ReadOnly="True" 

                    Width="180px"></asp:TextBox>
            </td>
            <td>
                <asp:TextBox ID="TextBoxAcad" runat="server" Width="180px" 

                    ToolTip="IPEDS Part C, Line 05, Column 01">0</asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator21" runat="server" 

                    ControlToValidate="TextBoxAcad" 

                    ErrorMessage="You Must Enter Academic Support!!!" ForeColor="Red" 

                    CssClass="style18"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style5">
                5</td>
            <td class="style7">
                Student Services <span class="style24">(IPEDS Part C, Line 01, Column 01)</span></td>
            <td class="style21">
                <asp:TextBox ID="TextBoxLYStudS" runat="server" Enabled="False" ReadOnly="True" 

                    Width="180px"></asp:TextBox>
            </td>
            <td>
                <asp:TextBox ID="TextBoxStudS" runat="server" Width="180px" 

                    ToolTip="IPEDS Part C, Line 06, Column 01">0</asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator22" runat="server" 

                    ControlToValidate="TextBoxStudS" 

                    ErrorMessage="You Must Enter Student Services!!!" ForeColor="Red" 

                    CssClass="style18"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style5">
                6</td>
            <td class="style7">
                Institutional Support<span class="style24"> (IPEDS Part C, Line 01, Column 01)</span></td>
            <td class="style21">
                <asp:TextBox ID="TextBoxLYInstiS" runat="server" Enabled="False" ReadOnly="True" 

                    Width="180px"></asp:TextBox>
            </td>
            <td>
                <asp:TextBox ID="TextBoxInstiS" runat="server" Width="180px" 

                    ToolTip="IPEDS Part C, Line 07, Column 01">0</asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator23" runat="server" 

                    ControlToValidate="TextBoxInstiS" 

                    ErrorMessage="You Must Enter Institutional Support!!!" ForeColor="Red" 

                    CssClass="style18"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style5">
                7</td>
            <td class="style7">
                Operation & Maintenance of Plant <span class="style24">(IPEDS Part C, Line 
                01, Column 01)</span></td>
            <td class="style21">
                <asp:TextBox ID="TextBoxLYOperM" runat="server" Enabled="False" ReadOnly="True" 

                    Width="180px"></asp:TextBox>
            </td>
            <td>
                <asp:TextBox ID="TextBoxOperM" runat="server" Width="180px" 

                    ToolTip="IPEDS Part C, Line 08, Column 01">0</asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator24" runat="server" 

                    ControlToValidate="TextBoxOperM" 

                    ErrorMessage="You Must Enter Operation & Maintenance of Plant!!!" 

                    ForeColor="Red" CssClass="style18"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style5">
                8</td>
            <td class="style7">
                Scholarships & Fellowships, Excluding Discounts & Allowances
                <span class="style24">(IPEDS Part C, Line 01, Column 01)</span></td>
            <td class="style21">
                <asp:TextBox ID="TextBoxLYSFEDA" runat="server" Enabled="False" ReadOnly="True" 

                    Width="180px"></asp:TextBox>
            </td>
            <td>
                <asp:TextBox ID="TextBoxSFEDA" runat="server" Width="180px" 

                    ToolTip="IPEDS Part C, Line 10, Column 01">0</asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator25" runat="server" 

                    ControlToValidate="TextBoxSFEDA" 

                    ErrorMessage="You Must Enter Scholarships & Fellowships!!!" 

                    ForeColor="Red" CssClass="style18"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style5">
                9</td>
            <td class="style7">
                Auxiliary Enterprises <span class="style24">(IPEDS Part C, Line 01, Column 01)</span></td>
            <td class="style21">
                <asp:TextBox ID="TextBoxLYAuxE" runat="server" Enabled="False" ReadOnly="True" 

                    Width="180px"></asp:TextBox>
            </td>
            <td>
                <asp:TextBox ID="TextBoxAuxE" runat="server" Width="180px" 

                    ToolTip="IPEDS Part C, Line 11, Column 01">0</asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator26" runat="server" 

                    ControlToValidate="TextBoxAuxE" 

                    ErrorMessage="You Must Enter Auxiliary Enterprises!!!" ForeColor="Red" 

                    CssClass="style18"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style5">
                10</td>
            <td class="style7">
                Hospital Services <span class="style24">(IPEDS Part C, Line 01, Column 01)</span></td>
            <td class="style21">
                <asp:TextBox ID="TextBoxLYHosS" runat="server" Enabled="False" ReadOnly="True" 

                    Width="180px"></asp:TextBox>
            </td>
            <td>
                <asp:TextBox ID="TextBoxHosS" runat="server" Width="180px" 

                    ToolTip="IPEDS Part C, Line 12, Column 01">0</asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator27" runat="server" 

                    ControlToValidate="TextBoxHosS" 

                    ErrorMessage="You Must Enter Hospital Services!!!" ForeColor="Red" 

                    CssClass="style18"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style5">
                11</td>
            <td class="style7">
                Independent Operations <span class="style24">(IPEDS Part C, Line 01, Column 01)</span></td>
            <td class="style21">
                <asp:TextBox ID="TextBoxLYIndeO" runat="server" Enabled="False" ReadOnly="True" 

                    Width="180px"></asp:TextBox>
            </td>
            <td>
                <asp:TextBox ID="TextBoxIndeO" runat="server" Width="180px" 

                    ToolTip="IPEDS Part C, Line 13, Column 01">0</asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator28" runat="server" 

                    ControlToValidate="TextBoxIndeO" 

                    ErrorMessage="You Must Enter Independent Operations!!!" ForeColor="Red" 

                    CssClass="style18"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style5">
                12</td>
            <td class="style7">
                Other Expenses & Deductions <span class="style24">(IPEDS Part C, Line 01, 
                Column 01)</span></td>
            <td class="style21">
                <asp:TextBox ID="TextBoxLYOED" runat="server" Enabled="False" ReadOnly="True" 

                    Width="180px"></asp:TextBox>
            </td>
            <td>
                <asp:TextBox ID="TextBoxOED" runat="server" Width="180px" 

                    ToolTip="IPEDS Part C, Line 14, Column 01">0</asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator29" runat="server" 

                    ControlToValidate="TextBoxOED" 

                    ErrorMessage="You Must Enter Other Expenses & Deductions!!!" 

                    ForeColor="Red" CssClass="style18"></asp:RequiredFieldValidator>
            </td>
        </tr>
        </table>
    <br />
    <br />
    <br />
    <table class="style2">
        <tr>
            <td class="style47">
                                          <span 

                    class="style49"> 
                Financial Indicators</span></td>
        </tr>
    </table>
    <br />
    <br />
    <table class="style3">
        <tr>
            <td class="style37">
                 </td>
            <td class="style38">
                     <asp:Label ID="lblLYEAR2" runat="server"></asp:Label>
                </td>
            <td class="style35">
                           
                <asp:Label ID="lblYEAR2" runat="server">2013</asp:Label>
                </td>
        </tr>
        <tr>
            <td class="style37">
                 </td>
            <td class="style57">
                 </td>
            <td class="style36">
                 </td>
        </tr>
        <tr>
            <td class="style37">
                Total Assets</td>
            <td class="style57">
                <asp:TextBox ID="TextBoxLYTA" runat="server" Width="180px" Enabled="False" 

                    ReadOnly="True"></asp:TextBox>
            </td>
            <td class="style36">
                <asp:TextBox ID="TextBoxTA" runat="server" Width="180px">0</asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator30" runat="server" 

                    ControlToValidate="TextBoxTA" 

                    ErrorMessage="You Must Enter A Number For This Field!!!" ForeColor="Red"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style37">
                Total Liabilities</td>
            <td class="style57">
                <asp:TextBox ID="TextBoxLYTL" runat="server" Width="180px" Enabled="False" 

                    ReadOnly="True"></asp:TextBox>
            </td>
            <td class="style36">
                <asp:TextBox ID="TextBoxTL" runat="server" Width="180px" AutoPostBack="True" 

                    ontextchanged="TextBoxTL_TextChanged">0</asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator31" runat="server" 

                    ControlToValidate="TextBoxTL" 

                    ErrorMessage="You Must Enter A Number For This Field!!!" ForeColor="Red"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style37">
                Total Net Assets</td>
            <td class="style57">
                 </td>
            <td class="style36">
                <asp:TextBox ID="TextBoxTNA" runat="server" Width="180px" Enabled="False" 

                    ReadOnly="True"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td class="style37">
                Nonexpendable/Permanently Restricted Net Assets</td>
            <td class="style57">
                <asp:TextBox ID="TextBoxLYNPRNA" runat="server" Width="180px" Enabled="False" 

                    ReadOnly="True"></asp:TextBox>
            </td>
            <td class="style36">
                <asp:TextBox ID="TextBoxNPRNA" runat="server" Width="180px">0</asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator32" runat="server" 

                    ControlToValidate="TextBoxNPRNA" 

                    ErrorMessage="You Must Enter A Number For This Field!!!" ForeColor="Red"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style37">
                Expendable/Temporarily Restricted Net Assets</td>
            <td class="style57">
                <asp:TextBox ID="TextBoxLYETRNA" runat="server" Width="180px" Enabled="False" 

                    ReadOnly="True"></asp:TextBox>
            </td>
            <td class="style36">
                <asp:TextBox ID="TextBoxETRNA" runat="server" Width="180px">0</asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator33" runat="server" 

                    ControlToValidate="TextBoxETRNA" 

                    ErrorMessage="You Must Enter A Number For This Field!!!" ForeColor="Red"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style37">
                Total Unrestricted Net Assets <span class="style23">(Unrestricted net assets 
                Plus capital assets, net)</span></td>
            <td class="style57">
                <asp:TextBox ID="TextBoxLYTUNA" runat="server" Width="180px" Enabled="False" 

                    ReadOnly="True"></asp:TextBox>
            </td>
            <td class="style36">
                <asp:TextBox ID="TextBoxTUNA" runat="server" Width="180px" AutoPostBack="True" 

                    ontextchanged="TextBoxTUNA_TextChanged">0</asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator34" runat="server" 

                    ControlToValidate="TextBoxTUNA" 

                    ErrorMessage="You Must Enter A Number For This Field!!!" ForeColor="Red"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style37">
                Total Revenue</td>
            <td class="style57">
                <asp:TextBox ID="TextBoxLYTR" runat="server" Width="180px" Enabled="False" 

                    ReadOnly="True"></asp:TextBox>
            </td>
            <td class="style36">
                <asp:TextBox ID="TextBoxTR" runat="server" Width="180px">0</asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator35" runat="server" 

                    ControlToValidate="TextBoxTR" 

                    ErrorMessage="You Must Enter A Number For This Field!!!" ForeColor="Red"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style37">
                Tuition and Fees, Net</td>
            <td class="style57">
                <asp:TextBox ID="TextBoxLYTFN" runat="server" Width="180px" Enabled="False" 

                    ReadOnly="True"></asp:TextBox>
            </td>
            <td class="style36">
                <asp:TextBox ID="TextBoxTFN" runat="server" Width="180px">0</asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator36" runat="server" 

                    ControlToValidate="TextBoxTFN" 

                    ErrorMessage="You Must Enter A Number For This Field!!!" ForeColor="Red"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style37">
                Current Debt</td>
            <td class="style57">
                <asp:TextBox ID="TextBoxLYCD" runat="server" Width="180px" Enabled="False" 

                    ReadOnly="True"></asp:TextBox>
            </td>
            <td class="style36">
                <asp:TextBox ID="TextBoxCD" runat="server" Width="180px">0</asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator37" runat="server" 

                    ControlToValidate="TextBoxCD" 

                    ErrorMessage="You Must Enter A Number For This Field!!!" ForeColor="Red"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style37">
                Long-term Debt</td>
            <td class="style57">
                <asp:TextBox ID="TextBoxLYLTD" runat="server" Width="180px" Enabled="False" 

                    ReadOnly="True"></asp:TextBox>
            </td>
            <td class="style36">
                <asp:TextBox ID="TextBoxLTD" runat="server" Width="180px">0</asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator38" runat="server" 

                    ControlToValidate="TextBoxLTD" 

                    ErrorMessage="You Must Enter A Number For This Field!!!" ForeColor="Red"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style37">
                Total Net Assets</td>
            <td class="style57">
                <asp:TextBox ID="TextBoxLYTNA" runat="server" Width="180px" Enabled="False" 

                    ReadOnly="True"></asp:TextBox>
            </td>
            <td class="style36">
                <asp:TextBox ID="TextBoxTNA2" runat="server" Width="180px" Enabled="False" 

                    ReadOnly="True"></asp:TextBox>
                <asp:CompareValidator ID="CompareValidator1" runat="server" 

                    ControlToCompare="TextBoxTNA" ControlToValidate="TextBoxTNA2" 

                    ErrorMessage="The Entry Does Not Match Each Other!!" ForeColor="Red"></asp:CompareValidator>
            </td>
        </tr>
    </table>
    <br />
    <br />
    <table class="style3">
        <tr>
            <td class="style40">
                Name</td>
            <td class="style42">
                <asp:TextBox ID="TextBoxFullN" runat="server" Width="180px"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 

                    ControlToValidate="TextBoxFullN" ErrorMessage="Please Give Your Full Name!!!" 

                    ForeColor="Red" CssClass="style18"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style40">
                Title</td>
            <td class="style42">
                <asp:TextBox ID="TextBoxTitle" runat="server" Width="180px"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 

                    ControlToValidate="TextBoxTitle" ErrorMessage="Please Give Your Title!!!" 

                    ForeColor="Red" CssClass="style18"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style40">
                Institution</td>
            <td class="style42">
                <asp:Label ID="lblSchool2" runat="server"></asp:Label>
            </td>
            <td>
                 </td>
        </tr>
        <tr>
            <td class="style40">
                Mailing Address</td>
            <td class="style42">
                <asp:TextBox ID="TextBoxMA" runat="server" Width="180px"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 

                    ControlToValidate="TextBoxMA" 

                    ErrorMessage="Please Give Your Mailing Address!!!" ForeColor="Red" 

                    CssClass="style18"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style41">
                 </td>
            <td class="style42">
                 </td>
            <td>
                 </td>
        </tr>
        <tr>
            <td class="style40">
                Telephone Number</td>
            <td class="style42">
                <asp:TextBox ID="TextBoxTN" runat="server" Width="180px"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" 

                    ControlToValidate="TextBoxTN" 

                    ErrorMessage="Please Give Your Telephone Number!!!" ForeColor="Red" 

                    CssClass="style18"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style40">
                Fax Number</td>
            <td class="style42">
                <asp:TextBox ID="TextBoxFN" runat="server" Width="180px"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" 

                    ControlToValidate="TextBoxFN" ErrorMessage="Please Give Your  Fax Number!!!" 

                    ForeColor="Red" CssClass="style18"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style40">
                Email Address</td>
            <td class="style42">
                <asp:TextBox ID="TextBoxEA" runat="server" Width="180px"></asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" 

                    ControlToValidate="TextBoxEA" ErrorMessage="Please Give Your Email Address!!!" 

                    ForeColor="Red" CssClass="style18"></asp:RequiredFieldValidator>
            </td>
        </tr>
    </table>
    <br />
    <br />
    <table class="style2">
        <tr>
            <td class="style19">
                                                                
                <asp:Button ID="ButtonSubmit" runat="server" onclick="ButtonSubmit_Click" 

                    Text="Submit" Width="100px" style="text-align: center" />
            </td>
            <td>
                <asp:Button ID="ButtonPrint" runat="server" Text="Print" Width="100px" />
            </td>
        </tr>
    </table>
    </form>
    </body>
</html>





The next code is the print button code:





The next code is the print button code:

protected void ButtonPrint_Click(object sender, EventArgs e)
        {
            Session["ctrl"] = Panel1;
            ClientScript.RegisterStartupScript(this.GetType(), "onclick", "<script language=javascript>window.open('Print.aspx','PrintMe','height=300px,width=300px,scrollbars=1');</script>");
        }

What I am saying is that if I have more than one Panel control How would I add that to my code?

推荐答案

Contents of the Panel control can be selectively printed . In case , need to exclude some controls , easiest way is to do it using CSS .



Adding references which will give you an idea



http://forums.asp.net/t/1706754.aspx[^]



http://www.dotnetcurry.com/showarticle.aspx?ID=92[^]



More reference on Print Style sheets



http://www.webcredible.co.uk/user-friendly-resources/css/print-stylesheet.shtml[^]
Contents of the Panel control can be selectively printed . In case , need to exclude some controls , easiest way is to do it using CSS .

Adding references which will give you an idea

http://forums.asp.net/t/1706754.aspx[^]

http://www.dotnetcurry.com/showarticle.aspx?ID=92[^]

More reference on Print Style sheets

http://www.webcredible.co.uk/user-friendly-resources/css/print-stylesheet.shtml[^]


这篇关于以Web表单打印所有面板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆