Hi,


I have a window that loads an aspx with a friendly version of a grid. Its a representation of it, made with aspTable.

This window is shown when the user press a preview button or a print button.

Taking advantage of post back need for other reasons, i can put on the query string a parameter indicating if the page is to print or preview and by testing that, i call a javascript function do print the window.

The problem is that the print dialog never shows. Can anyone help?


Here is the code of the window
    <ext:Window ID="windowPreview" runat="server" Title="Pré-Visualização" Height="500px" Width="860px"
        Modal="false" Resizable="true" Mode="LoadMode.IFrame" BodyStyle="padding: 6px; background-color: #fff;"
        Maximizable="false" Closable="true" Show&#111;nload="false" AutoScroll="true" MaskDisabled="false"
        CloseAction="Hide">

    </ext:Window>

and the page that renders on it
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script type="text/javascript" language="javascript">
        function print() {
            window.print();
        }
    </script>
    <style type="text/css">
        table
        {
            border-collapse:collapse;
            width: 21cm;
            padding:2px;
            
        }
        td
        {
            border-style:solid;
            border-color:Black;
            border-width:1px;
            border-collapse:collapse;
            font-family:Arial;
            font-size:10px;
        }
        .boldFont
        {
            font-weight:bold;
        }
        .fillCell
        {
            background-color:#D7D7D7;
            
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <asp:Table ID="masterTable" runat="server" CellPadding="0" CellSpacing="0">
        <asp:TableRow>
            <asp:TableCell rowspan="4" style="border-bottom:none;border-left:none;border-top:none;" ColumnSpan="7">
                <img src="../App_Themes/Default/images/PDF/logo.PNG" alt="Regularte" />
                <img src="../App_Themes/Default/images/PDF/certificados.PNG" alt="Certificados" style="vertical-align: top;" />
            </asp:TableCell>
            <asp:TableCell style="text-align: center" CssClass="boldFont">
                Ano
            </asp:TableCell>
            <asp:TableCell style="text-align: center" ColumnSpan="3" >
                <asp:Label ID="lblAno" runat="server" Text=""></asp:Label>
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell style="text-align: center" CssClass="boldFont">
                Mês
            </asp:TableCell>
            <asp:TableCell style="text-align: center" ColumnSpan="3">
                <asp:Label ID="lblMes" runat="server" Text=""></asp:Label>
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow>
            <asp:TableCell style="text-align: center" CssClass="boldFont">
                Nome
            </asp:TableCell>
            <asp:TableCell style="text-align: center" ColumnSpan="3">
                <asp:Label ID="lblNome" runat="server" Text=""></asp:Label>
            </asp:TableCell>
        </asp:TableRow>
        <asp:TableRow >
            <asp:TableCell style="text-align: center; border-bottom:none;" CssClass="boldFont">
                Profissão
            </asp:TableCell>
            <asp:TableCell style="text-align: center;border-bottom:none;" ColumnSpan="3">
                <asp:Label ID="lblCate" runat="server" Text=""></asp:Label>

            </asp:TableCell>
        </asp:TableRow>
    </asp:Table>
    </form>
</body>
</html>
C# code of preview page
        protected void Page_Load(object sender, EventArgs e)

        {
            if (Request.QueryString["print"] != null)
                this.Page.Form.Attributes["onload"] = "print()";
                //ClientScript.RegisterStartupScript(this.GetType(), "print", "window.print()", true);
            if (!IsPostBack)
            {

                if (Year.Equals(-1) || Month.Equals(-1) || WorkerID.Equals(-1))
                {
                    Response.Write("Error generating PDF. Missing parameters.");
                }
                PopulateTable();
            }
        }
Thanks,
Nuno Santos