Click here to Skip to main content
15,919,245 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
A user can fill out the web form I have and submit the data that they entered into the textboxes. Before the user clicks on submit I would like for them to click on print and the form will print to a word document. I have a word document on my computer. It has the same fields as the web page does. How can I upload the word document to Asp.Net and when the user clicks on print the word document prints out with the data the user just submitted? Is this possible to do?

ASP.NET
<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation = "false" CodeBehind="Gradrate.aspx.cs" Inherits="SACSCOCLogin1._1.Gradrate" %>

<!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
        {
            width: 585px;
            height: 137px;
        }
        .style2
        {
            font-size: x-large;
            text-align: center;
        }
        .style3
        {
            width: 100%;
        }
        .style4
        {
            width: 520px;
        }
        .style5
        {
            width: 188px;
        }
        .style9
        {
            font-size: x-large;
            text-decoration: underline;
            text-align: center;
        }
        .style10
        {
            width: 189px;
        }
        .style11
        {
            font-weight: bold;
            text-align: center;
        }
        .style13
        {
            width: 73px;
            font-size: large;
        }
        .style15
        {
            font-weight: bold;
            font-size: x-large;
        }
        .style16
        {
            width: 673px;
        }
        .style17
        {
            color: #FF0000;
            font-size: large;
            text-align: center;
        }
        .style18
        {
            width: 131px;
        }
        .style19
        {
            width: 190px;
        }
        .style20
        {
            width: 190px;
            text-align: center;
        }
        .style21
        {
            width: 188px;
            text-align: center;
        }
        .style22
        {
            width: 713px;
        }
        .style23
        {
            font-weight: bold;
            font-size: large;
        }
        .style24
        {
            width: 653px;
        }
        .style25
        {
            width: 204px;
        }
    </style>
</head>
<body background="Images/bkg-blu.jpg">
    <form id="form1" runat="server">
    <div style="text-align: center">
    
        <img alt="" class="style1" src="Images/buildout_header.jpg" /></div>
    <p>
        <asp:TextBox ID="TextBoxINST_ID" runat="server" Enabled="False" ReadOnly="True" 
            Visible="False"></asp:TextBox>
        <asp:TextBox ID="TextBoxaccessLevel" runat="server" Visible="False"></asp:TextBox>
    </p>
    <p class="style2">
         </p>
    <div class="style9">
        Graduation Rate Information<br />
        </div>
    <p class="style17">
        "Note, if your institution reports more than one set of cohorts using 
        more than one Unit ID, Please enter the Unit ID into the textbox first before 
        anything else. Then enter the information needed. This form will reset once you 
        have clicked the Submit button and you will remain on this page to enter additional cohorts."</p>
    <p class="style17">
         </p>
    <table class="style3">
        <tr>
            <td style="text-align: center">
                <asp:Label ID="lblSchool" runat="server" CssClass="style15"></asp:Label>
            </td>
        </tr>
    </table>
    <table class="style3">
        <tr>
            <td class="style16" style="text-align: right">
                <asp:Label ID="lblCity" runat="server" CssClass="style23"></asp:Label>
                 ,</td>
            <td>
 
                <asp:Label ID="lblState" runat="server" CssClass="style23"></asp:Label>
            </td>
        </tr>
    </table>
    <br />
    Unit ID (Six-Digit IPEDS institution number):<br />
    <table class="style3">
        <tr>
            <td class="style13">
                Unit ID</td>
            <td class="style18">
                <asp:TextBox ID="TextBoxUNITID" runat="server" AutoPostBack="True" 
                    ontextchanged="TextBoxUNITID_TextChanged" Width="180px">0</asp:TextBox>
            </td>
            <td class="style24">
                <asp:RequiredFieldValidator ID="RequiredFieldValidator24" runat="server" 
                    ControlToValidate="TextBoxUNITID" ErrorMessage="You Must Enter a Unit ID!!!!" 
                    ForeColor="Red" style="font-weight: 700" Display="Dynamic"></asp:RequiredFieldValidator>
            </td>
            <td>
                Today's Date</td>
            <td class="style25">
                
                <asp:TextBox ID="TextBoxDATE" runat="server" Width="180px" CssClass="style11" 
                    Enabled="False" ReadOnly="True" style="text-align: center"></asp:TextBox>
                
            </td>
            <td>
                <asp:Label ID="lblTime" runat="server" style="font-weight: 700"></asp:Label>
            </td>
        </tr>
        <tr>
            <td class="style13">
                 </td>
            <td class="style18">
                 </td>
            <td class="style24">
                 </td>
        </tr>
        </table>
    <table class="style3">
        <tr>
            <td class="style4">
                 </td>
            <td class="style5">
                 </td>
            <td class="style19">
                              
            </td>
            <td>
                 </td>
        </tr>
        <tr>
            <td class="style4">
                 </td>
            <td class="style5">
                      PREVIOUS YEAR</td>
            <td class="style19">
                                 
                YEAR</td>
            <td>
                 </td>
        </tr>
        <tr>
            <td class="style4">
                 </td>
            <td class="style21">
                <asp:TextBox ID="TextBoxLYEAR" runat="server" Width="180px" Enabled="False" 
                    ReadOnly="True" style="text-align: center"></asp:TextBox>
            </td>
            <td class="style20">
                <asp:TextBox ID="TextBoxYEAR" runat="server" Width="180px" CssClass="style11" 
                    Enabled="False" ReadOnly="True">2013</asp:TextBox>
            </td>
            <td>
                 </td>
        </tr>
    </table>
    <table class="style3">
        <tr>
            <td class="style4">
                Associates / Two-Year Program</td>
            <td class="style5">
                 </td>
            <td class="style10">
                 </td>
            <td>
                 </td>
        </tr>
        <tr>
            <td class="style4">
                1. Total Number of Students in the Cohort</td>
            <td class="style5">
                <asp:TextBox ID="TextBoxLYTNUGSC" runat="server" Width="180px" 
                    ReadOnly="True" Enabled="False"></asp:TextBox>
            </td>
            <td class="style10">
                <asp:TextBox ID="TextBoxTNUGSC" runat="server" Width="180px">0</asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator16" runat="server" 
                    ControlToValidate="TextBoxTNUGSC" ErrorMessage="You Must Enter Total Students Cohort" 
                    ForeColor="Red" CssClass="style11"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style4">
                2. Total Number of Students Completed within 150% of Time of Degree</td>
            <td class="style5">
                <asp:TextBox ID="TextBoxLYTNUGSCD" runat="server" Width="180px" 
                    ReadOnly="True" Enabled="False"></asp:TextBox>
            </td>
            <td class="style10">
                <asp:TextBox ID="TextBoxTNUGSCD" runat="server" Width="180px">0</asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator17" runat="server" 
                    ControlToValidate="TextBoxTNUGSCD" ErrorMessage="You Must Enter Total Students Completed" 
                    ForeColor="Red" CssClass="style11"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style4">
                3. Total Transfers Out</td>
            <td class="style5">
                <asp:TextBox ID="TextBoxLYTTOUG" runat="server" Width="180px" 
                    ReadOnly="True" Enabled="False"></asp:TextBox>
            </td>
            <td class="style10">
                <asp:TextBox ID="TextBoxTTOUG" runat="server" Width="180px">0</asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator18" runat="server" 
                    ControlToValidate="TextBoxTTOUG" ErrorMessage="You Must EnterTotal Transfers" 
                    ForeColor="Red" CssClass="style11"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style4">
                Baccalaureate / Four-Year Program</td>
            <td class="style5">
                 </td>
            <td class="style10">
                 </td>
            <td>
                 </td>
        </tr>
        <tr>
            <td class="style4">
                4. Total Number of Students in the Cohort</td>
            <td class="style5">
                <asp:TextBox ID="TextBoxLYTNGSC" runat="server" Width="180px" 
                    ReadOnly="True" Enabled="False"></asp:TextBox>
            </td>
            <td class="style10">
                <asp:TextBox ID="TextBoxTNGSC" runat="server" Width="180px">0</asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator19" runat="server" 
                    ControlToValidate="TextBoxTNGSC" ErrorMessage="You Must Enter Total Students Cohort" 
                    ForeColor="Red" CssClass="style11"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style4">
                5. Total Number of Students Completed within 150% of Time of Degree</td>
            <td class="style5">
                <asp:TextBox ID="TextBoxLYTNGSCD" runat="server" Width="180px" 
                    ReadOnly="True" Enabled="False"></asp:TextBox>
            </td>
            <td class="style10">
                <asp:TextBox ID="TextBoxTNGSCD" runat="server" Width="180px">0</asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator20" runat="server" 
                    ControlToValidate="TextBoxTNGSCD" ErrorMessage="You Must Enter Total Students Completed" 
                    ForeColor="Red" CssClass="style11"></asp:RequiredFieldValidator>
            </td>
        </tr>
        <tr>
            <td class="style4">
                6. Total 
                Transfers Out</td>
            <td class="style5">
                <asp:TextBox ID="TextBoxLYTTOG" runat="server" Width="180px" 
                    ReadOnly="True" Enabled="False"></asp:TextBox>
            </td>
            <td class="style10">
                <asp:TextBox ID="TextBoxTTOG" runat="server" Width="180px">0</asp:TextBox>
            </td>
            <td>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator21" runat="server" 
                    ControlToValidate="TextBoxTTOG" ErrorMessage="You Must EnterTotal Transfers" 
                    ForeColor="Red" CssClass="style11"></asp:RequiredFieldValidator>
            </td>
        </tr>
    </table>
    <br />
    <br />
    <table class="style3">
        <tr>
            <td style="text-align: justify" class="style22">
                                                                                                                                          
                <asp:Button ID="Submit" runat="server" Text="Submit" Width="75px" 
                    onclick="Submit_Click" />
            </td>
            <td style="text-align: left">
                                               
                <asp:Button ID="Print" runat="server" Text="Print" Width="75px" 
                    onclick="Print_Click" />
            </td>
        </tr>
    </table>
    </form>
    </body>
</html>


I am trying to get this page printed out with the data in it. I don't need the textboxex that is under the Previous Year column. If I could get the Logo and the other textboxes with the data in it to be printed. How can i do this?
Posted
Updated 13-Jan-14 8:51am
v3

1 solution

I have already answered at Print screen on a document.[^].
 
Share this answer
 
Comments
Computer Wiz99 13-Jan-14 12:43pm    
Tadit Dash, Thanks for doing that but the question was deleted.
No it is not. Just click the link, you can see it. :)
Computer Wiz99 13-Jan-14 14:47pm    
Ok. Tjhis is what I am trying to do. I have a web form that has textboxes in it with images also. I wan to take the web page and print it. Not a screen print but print the page so it will only show the fields that the user has entered. I have updated the code to show you the page setup.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900