Client side webform printing


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 1 of 1

Thread: Client side webform printing

  1. #1
    Join Date
    Jun 2008
    Posts
    1

    Exclamation Client side webform printing

    Hey everyone,

    (the following statement might be as stale as 5 day old bread, but here I go)
    I'm not sure if this is possible at all, but what I want to do is the following:
    - Create a printerfriendly webpage (I think I've done this properly)
    - Print the entire webform (webform contains several tables which function as matrix reports)
    - Each matrix report should be on its own printed page

    Problem:
    - It only prints one page, so a lot of the information that's supposed to go on the other pages gets lost.
    - The tables (matrix reports) aren't being printed on seperate pages.

    My code:
    Code:
    <%@ Page Language="c#" AutoEventWireup="false" Inherits="App_Code.BenchmarkReport.Pages.Matrix.MatrixPrint"%>
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head runat="server">
        <title>
    	    Company Cockpit - <%= TranslateText("BMR_REPORT_MATRIX") %>
    	</title>
        <%= StyleSheetCode %>
        <style type="text/css">
            @media print 
            {
                input.noPrint 
                {
                    display: none;
                }
            }
            .tblValues_Values
            {
                padding-left:2px;
                padding-right:2px;
            }
        </style>
    	<script type="text/javascript" src="layout/browser.js"></script>
    	<script type="text/javascript" src="layout/functions.js"></script>
    	<script type="text/javascript" src="js/prototype.js"></script>
    </head>
    <body>
        <form id="form1" runat="server">
        <button type="button" onclick="window.print();" class="layout_form_input_button noPrint">Print</button>
        <div style="position:absolute;left:30px; top:120px;">
            <asp:Repeater ID="rpPeriods" runat="server">
                <HeaderTemplate>
                </HeaderTemplate>
                <ItemTemplate>
                    <div style="page-break-after:always;">
                        <table id="tblMatrixTable" class="layout_table">
                            <tr>
                                <th class="layout_table_header"><%# FormatPeriod(Container.DataItem)%></th>
                            </tr>
                            <table id="tblMatrix" class="layout_table">
                                <asp:Repeater ID="rpPeriodValues" DataSource="<%# GetValuesForPeriod(Container.DataItem) %>" runat="server">
                                    <HeaderTemplate>
                                <tr class="<%# (Container.ItemType == ListItemType.Item) ? "layout_tablerow_alternate" :  "layout_tablerow_normal" %>">
                                    <th class="layout_table_header">Indicator</th>
                                    <th class="layout_table_header"><%# TranslateText("BMR_REPORT_MATRIX_BMMIN") %></th>
                                    <th class="layout_table_header"><%# TranslateText("BMR_REPORT_MATRIX_BMAVG") %></th>
                                    <th class="layout_table_header"><%# TranslateText("BMR_REPORT_MATRIX_BMMAX") %></th>
                                    <th class="layout_table_header"><%# TranslateText("BMR_REPORT_MATRIX_OWN") %></th>
                                </tr>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                <tr class="<%# (Container.ItemType == ListItemType.Item) ? "layout_tablerow_alternate" :  "layout_tablerow_normal" %>">
                                    <td class="tblValues_Values"><%# FormatIndicator(Container.DataItem) %></td>
                                    <td align="right" class="tblValues_Values"><%# FormatMinValue(Container.DataItem) %></td>
                                    <td align="right" class="tblValues_Values"><%# FormatAvgValue(Container.DataItem) %></td>
                                    <td align="right" class="tblValues_Values"><%# FormatMaxValue(Container.DataItem) %></td>
                                    <td align="right" class="tblValues_Values" style="background-color:<%# CurrentValueBackColor(Container.DataItem) %>; color:<%# CurrentValueForeColor(Container.DataItem) %>;"><%# FormatCurValue(Container.DataItem) %></td>
                                </tr>
                                    </ItemTemplate>
                                    <FooterTemplate>
                                    </FooterTemplate>
                                </asp:Repeater>
                            </table>
                        </table>
                    </div>-
                </ItemTemplate>
                <FooterTemplate>
                </FooterTemplate>
            </asp:Repeater>
        </div>
        </form>
    </body>
    </html>
    Can anybody shed any light on this for me ?
    I'm really at a loss here and I really need to get this finished.

    Thanks

    EDIT:
    In case you might wonder, I've already read the other posts on this forum on printing, which all suggest the window.print() method.
    Which is just fine an dandy, as the printer will spring in to action, but it will only print one page, which means the rest of the data shown on the webform isn't printed.
    I'm really in need of this code, so please, any help would be greatly appreciated.

    EDIT:
    The plot thickens.
    I develop on FireFox and debug Internet Explorer.
    Unfortuntely it has prevented me from seeing that the window.print() method is working in IE, but not in FF.
    Internet Explorer is printing the entire webform like it's supposed to, FireFox however, is not...
    One should know that I have every page opened in the same tabbar, even the print-dialog...
    Any takers on this ?
    Last edited by bsprui; 06-19-2008 at 12:01 PM.

Similar Threads

  1. Printing in client side
    By Hsn in forum Java
    Replies: 1
    Last Post: 08-22-2006, 07:25 AM
  2. arrays from server side to client side
    By srivatsa in forum ASP.NET
    Replies: 2
    Last Post: 12-15-2000, 08:09 AM
  3. Replies: 3
    Last Post: 06-16-2000, 03:51 PM
  4. Combine Client Side & Server Side?
    By Jeff in forum ASP.NET
    Replies: 2
    Last Post: 04-20-2000, 08:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center