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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Set View Mode to Print on Load

Thread ID:

Created:

Updated:

Platform:

Replies:

125613 Aug 29,2016 07:17 AM UTC Aug 31,2016 11:36 AM UTC ASP.NET Web Forms 4
loading
Tags: ReportViewer
Glenn Bowles
Asked On August 29, 2016 07:17 AM UTC

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

Yuvaraj Devarajan [Syncfusion]
Replied On 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. 


Glenn Bowles
Replied On 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>

Glenn Bowles
Replied On 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



Yuvaraj Devarajan [Syncfusion]
Replied On 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. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;