We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Starting in 2019, the Reporting control is no longer included in Essential Studio®. If you're experiencing issues with the Syncfusion Reporting Platform, Report Viewer, Report Designer, or Report Writer, we recommend migrating to Bold Reports, our dedicated reporting platform.

Bold Reports offers a comprehensive suite of tools and features for all your reporting needs, and we will help you make a smooth transition from the discontinued control. Our support team at https://support.boldreports.com/ is here to assist you with any questions or difficulties you may encounter during the migration process.

We thank you for choosing Syncfusion and appreciate your understanding.

Set View Mode to Print on Load

How can I make the Reportviewer default to Print Mode as oppose to normal mode on load via server side or client side?

4 Replies

YD Yuvaraj Devarajan Syncfusion Team August 30, 2016 06:32 AM UTC

Hi Glenn, 
 
Thanks for contacting Syncfusion support. 
 
In ReportViewer control, we have an API option “printMode” to render the report in print layout mode. By default, the “printMode” option is set to false. If we specify the “printMode” option as true, then the report renders in print layout mode as shown in the code example below.  

       <script type="text/javascript"> 
        $(function () { 
            $("#container").ejReportViewer( 
                { 
                    reportServiceUrl: '/api/ReportApi', 
                    processingMode: ej.ReportViewer.ProcessingMode.Remote,                 
                    printMode: true, 
                    reportPath: '~/App_Data/GroupingAgg.rdl' 
                }); 
        }); 
    </script>    

We have prepared a sample and it can be downloaded, 

Please refer to the UG documentation link for more information, 

Regards, 
Yuvaraj D. 



GB Glenn Bowles August 30, 2016 11:12 PM UTC

Thanks here is what I used to get it to work for Syncfusion ASP Reportviewer control:

 <script type="text/javascript">         
     $(function () {
        $("#ReportViewer1").ejReportViewer(
             {
              printMode: true,
                              });
     });
               
</script>
 
<ej:ReportViewer ID="ReportViewer1" runat="server" ClientIDMode="Static" ProcessingMode="Local" ReportPath="~/Reports/Invoice/Invoice.rdlc" Height="1200px" Width="100%" >
<ToolbarSettings ShowToolbar="True"></ToolbarSettings>
</ej:ReportViewer>


GB Glenn Bowles August 31, 2016 07:02 AM UTC

Just to confirm I got it working using the code as per my last post.  I should have also mentioned that theReportServiceURL was set in my case from code behind.

Thanks




YD Yuvaraj Devarajan Syncfusion Team August 31, 2016 11:36 AM UTC

Hi Glenn, 
 
Thanks here is what I used to get it to work for Syncfusion ASP Reportviewer control: 
 
 <script type="text/javascript">          
     $(function () { 
        $("#ReportViewer1").ejReportViewer( 
             { 
              printMode: true, 
                              }); 
     }); 
                
</script> 
 
<ej:ReportViewer ID="ReportViewer1" runat="server"  
ClientIDMode="Static" ProcessingMode="Local"  
ReportPath="~/Reports/Invoice/Invoice.rdlc" Height="1200px"  
Width="100%" > 
<ToolbarSettings ShowToolbar="True"></ToolbarSettings> 
</ej:ReportViewer> 
Just to confirm I got it working using the code as per my last post. 

We have printLayout() method to render/change the print option in our ReportViewer component. So please invoke the printLayout() method to change the print layout once rendered reportviewer container as shown in below code example, 
<script type="text/javascript">               
        function onreportLoaded() { 
            var reportObj = $('#ReportViewer1').data('ejReportViewer');            
            reportObj.printLayout(); 
        } 
       </script> 

We have prepared the sample and it can be downloaded from, 

Please refer to the below UG documentation for more information, 
 I should have also mentioned that the ReportServiceURL was set in my case from code behind. 
Yes, you can also specify the ReportServiceURL in aspx.cs page from code behind to render the ReportViewer control as shown in the following code example, 
 
Default.aspx.cs: 
public partial class Default : System.Web.UI.Page 
    { 
        protected void Page_Load(object sender, EventArgs e) 
        { 
            this.ReportViewer1.ReportServiceUrl = VirtualPathUtility.ToAbsolute("~/api/ReportApi"); 
        } 
    } 
 
We have prepared a sample based on this and shared in above response.  

Regards, 
Yuvaraj D. 


Loader.
Up arrow icon