locked
rdlc report didnt print RRS feed

  • Question

  • User1465791785 posted

    i want to print rdlc report generated in the report viewer to print automatically when the print button is clicked, from the code, i have written , the whole report viewer is exported to print page, culdnt see the report generated , here is what i have done so far

    <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
        <style type="text/css">
            .auto-style1 {
                width: 100%;
            }
    
            .auto-style2 {
                width: 90px;
            }
    
            .auto-style3 {
                width: 214px;
            }
        </style>
             <script type="text/jscript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.0.min.js"></script>
        <script type="text/javascript">
            function PrintPanel() {
                var panel = document.getElementById("<%=ReportViewer1.ClientID %>");
                var printWindow = window.open('', '', 'height=400,width=800');
                printWindow.document.write('<html><head>');
                printWindow.document.write('</head><body >');
                printWindow.document.write(panel.innerHTML);
                printWindow.document.write('</body></html>');
                printWindow.document.close();
                setTimeout(function () {
                    printWindow.print();
                }, 500);
                return false;
            }
        </script>
      
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
        <table class="auto-style1">
            <tr>
                <td colspan="2">Port Activities</td>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <td class="auto-style2">Date From</td>
                <td class="auto-style3">
                    <asp:TextBox ID="txtStartDate" runat="server"></asp:TextBox>
                </td>
                <td>Date To<asp:TextBox ID="txtEndDate" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td class="auto-style2">
                    <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" />
                </td>
                <td class="auto-style3">
                    <asp:Label ID="lblMessage" runat="server" Visible="False"></asp:Label>
                </td>
                <td>
                    <asp:Button ID="PrintButton" Text="Print" runat="server"  OnClientClick="return PrintPanel();" />
                </td>
            </tr>
        </table>
        <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
        </asp:ToolkitScriptManager>
        <%--      <asp:Panel ID="pnlContents" runat="server">--%>
    
        <rsweb:ReportViewer ID="ReportViewer1" runat="server" Width="895px" Font-Names="Verdana" Font-Size="8pt" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt">
            <LocalReport ReportPath="Reports\DepartureReport.rdlc" EnableHyperlinks="True">
                <DataSources>
                    <rsweb:ReportDataSource DataSourceId="SqlDataSource1" Name="DataSet1" />
                </DataSources>
            </LocalReport>
        </rsweb:ReportViewer>
        <%--    </asp:Panel>
        --%>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConectionString %>" SelectCommand="PortActvitiesFinal" SelectCommandType="StoredProcedure">
            <SelectParameters>
                <asp:Parameter Name="chkDate" Type="DateTime" />
                <asp:Parameter Name="EndDate" Type="Datetime" />
    
            </SelectParameters>
        </asp:SqlDataSource>
    
    
    </asp:Content>

    Tuesday, July 15, 2014 6:02 AM

All replies