Printing an ASP.NET Web Form When It Is Submitted
page 4 of 5
by Andrew Mooney
Feedback
Average Rating: 
Views (Total / Last 10 Days): 54939/ 65

Using a Results Page

[Download Code]
The results page that I use simply iterates the querystring that was created by the web form printing class to display the results. One of the reasons for using a results page is that it allows the user to print a hard copy for their records. Yes, I know it's a waste of paper. The results page can easily be removed from the web form printing class if you do not need it for your application.

Results.aspx:

<%@ Page language="c#" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
 <head>
  <title>Results</title>
 </head>
 <body>
  <form runat="server" ID="Form1">
   <table cellspacing="1" cellpadding="1" border="0">
    <tr>
     <td bgcolor="navy" colspan="2">
      <font color="white" size="3">Results&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<% = 
         System.DateTime.Now.ToString() %></font></td>
    </tr>
    <% string fieldValue;
    foreach ( string fieldName in Request.QueryString ) {
    if ( Request.QueryString[fieldName] != "" ) fieldValue = 
        Request.QueryString[fieldName] ;
    else fieldValue = "&nbsp;"; 
    %>
    <tr>
     <td align="right" bgcolor="lightskyblue"><b><%= fieldName %></b></td>
     <td bgcolor="lightskyblue"><%= fieldValue %></td>
    </tr>
    <% } %>
   </table>
  </form>
 </body>
</html>


View Entire Article

User Comments

No comments posted yet.






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-26 1:37:43 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search