locked
ReportViewer RRS feed

  • Question

  • User-1499457942 posted

    Hi

      I am using ReportViewer & when i run in Chrome/FireFox Print Button is not appearing . I checked the below link . How it will work.

    http://aspsolutionkirit.blogspot.com/2015/10/how-to-show-print-button-in-report.html

    Thanks

    Tuesday, December 4, 2018 10:01 AM

All replies

  • User283571144 posted

    Hi JagjitSingh,

    As far as I known,ReportViewer client printing feature relies on ActiveX and it  is not supported by  Chrome, Firefox except IE 9 (or earlier), that's why you do not get print button.I suggest you to add a button to realize the print function.Here is the code I think it will help you.

    <head runat="server">
        <title></title>
        <script>
            window.onload = function ()
            {
                var a = document.getElementById("Button1");
                a.onclick = function ()
                {
                    window.print();
                }
    
            }
    
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
            <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
            <rsweb:ReportViewer ID="ReportViewer1" runat="server" BackColor="" ShowPrintButton="true" ClientIDMode="AutoID" HighlightBackgroundColor="" InternalBorderColor="204, 204, 204" InternalBorderStyle="Solid" InternalBorderWidth="1px" LinkActiveColor="" LinkActiveHoverColor="" LinkDisabledColor="" PrimaryButtonBackgroundColor="" PrimaryButtonForegroundColor="" PrimaryButtonHoverBackgroundColor="" PrimaryButtonHoverForegroundColor="" SecondaryButtonBackgroundColor="" SecondaryButtonForegroundColor="" SecondaryButtonHoverBackgroundColor="" SecondaryButtonHoverForegroundColor="" SplitterBackColor="" ToolbarDividerColor="" ToolbarForegroundColor="" ToolbarForegroundDisabledColor="" ToolbarHoverBackgroundColor="" ToolbarHoverForegroundColor="" ToolBarItemBorderColor="" ToolBarItemBorderStyle="Solid" ToolBarItemBorderWidth="1px" ToolBarItemHoverBackColor="" ToolBarItemPressedBorderColor="51, 102, 153" ToolBarItemPressedBorderStyle="Solid" ToolBarItemPressedBorderWidth="1px" ToolBarItemPressedHoverBackColor="153, 187, 226">
                <LocalReport ReportPath="Report1.rdlc">
                    <DataSources>
                        <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="DataSet1" />
                        
                    </DataSources>
                </LocalReport>
            </rsweb:ReportViewer>
         <input id="Button1" type="button" value="print" />
           
            <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetData" TypeName="Demo.MyDatabase2DataSetTableAdapters.studentTableAdapter"></asp:ObjectDataSource>
         
           
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:mssqlserver %>" SelectCommand="SELECT * FROM [TreeTest]"></asp:SqlDataSource>
           
        </form>
    </body>
    

    Result:

    Wednesday, December 5, 2018 10:08 AM