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
Syncfusion site will be temporarily unavailable for scheduled maintenance on December 14, 2024, from 10:30 PM ET to 11:30 PM ET.
close icon
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.

how to use report viewer in asp.net mvc

how to use report viewer in asp.net mvc 4 with visual studio express 2012?

7 Replies

LS Lingaraj S Syncfusion Team April 12, 2013 09:13 AM UTC

Hi Narinder,

                       

Thanks you for your interest in Syncfusion products.

 

Please do the following steps to use the ReportViewer in MVC application.

 

1.      Add following assemblies into your for MVC Application.    

a.       Syncfusion.Core.

b.      Syncfusion.Theme.base.

b.      Syncfusion.Shared.MVC.

c.       Syncfusion.Linq.Base.

d.      Syncfusion.ReportViewer.MVC.

 

2.      If you like to use Chart and Gauge with ReportViewer then. You have to add following assemblies also in your application.

a.       Syncfusion.Core.

b.      Syncfusion.Shared.WPF.

b.      Syncfusion.Chart.WPF.

c.       Syncfusion.Gauge.WPF.

 

3.      Add Syncfusion Assemblies and Namespace information in WebConfig.

  <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="Syncfusion.Core, Version=11.104.0.21, Culture=neutral, PublicKeyToken=632609B4D040F6B4"/>
        <add assembly="Syncfusion.Shared.Mvc, Version=11.144.0.21, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89"/>
        <add assembly="Syncfusion.Linq.Base, Version=11.104.0.21, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89"/>
        <add assembly="Syncfusion.ReportViewer.Mvc, Version=11.144.0.21, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89""/>
      </assemblies>
    </compilation>
    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880" />
    </authentication>
    <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
        <add namespace="Syncfusion.Mvc.Shared"/>
        <add namespace="Syncfusion.ReportViewer.Mvc"/>
      </namespaces>
    </pages>

 

4.      Add http handlers for  ReportViewer and Script Manager in Web config.

 <system.webServer>
    <handlers>
      <remove name="MvcResourceHandler"/>
      <add verb="GET,HEAD" name="MvcResourceHandler" path="MvcResourceHandler.axd" 
type="Syncfusion.Mvc.Shared.MvcResourceHandler, Syncfusion.Shared.Mvc, Version=11.144.0.21, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89"/>
      <add verb="*" path="syncfusion_generatereports.axd" name="syncfusion_generatereports" 
type="Syncfusion.ReportViewer.Mvc.ReportViewerHandler, Syncfusion.ReportViewer.Mvc, Version=11.144.0.21, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89"/>
    </handlers>
    <validation validateIntegratedModeConfiguration="false" />
    <modules runAllManagedModulesForAllRequests="true" />
  </system.webServer>
  
  <system.web>
    <compilation debug="true" targetFramework="4.0">
      <assemblies>
        <add assembly="Syncfusion.Core, Version=11.104.0.21, Culture=neutral, PublicKeyToken=632609B4D040F6B4"/>
        <add assembly="Syncfusion.Shared.Mvc, Version=11.144.0.21, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89"/>
        <add assembly="Syncfusion.Linq.Base, Version=11.104.0.21, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89"/>
        <add assembly="Syncfusion.ReportViewer.Mvc"/>
      </assemblies>
    </compilation>
    <authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880" />
    </authentication>
    <pages>
      <namespaces>
        <add namespace="System.Web.Helpers" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
        <add namespace="System.Web.WebPages" />
        <add namespace="Syncfusion.Mvc.Shared"/>
        <add namespace="Syncfusion.ReportViewer.Mvc"/>
      </namespaces>
    </pages>
    <httpHandlers>
      <add verb="GET,HEAD" path="MvcResourceHandler.axd" 
type="Syncfusion.Mvc.Shared.MvcResourceHandler, Syncfusion.Shared.Mvc, Version=11.144.0.21, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" 
validate="false"/>
      <add verb="*" path="syncfusion_generatereports.axd" validate="false" 
type="Syncfusion.ReportViewer.Mvc.ReportViewerHandler, Syncfusion.ReportViewer.Mvc, Version=11.144.0.21, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89"/>
    </httpHandlers>

 

 

5.      We have to add Ajax and JQuery information page.

6.      Syncfusion ScriptManager need to rendered in that page.

 

Razor:

 

<!DOCTYPE html>

<html>

<head runat="server">

    <meta name="viewport" content="width=device-width" />

    <title>ViewReport</title>

    <script src="@Url.Content("~/Scripts/jquery-1.6.2.min.js")" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/MicrosoftAjax.js")" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/MicrosoftMvcAjax.js")" type="text/javascript"></script>

</head>

<body>

    <div style="width:100%;height:400px;">    

        @{Html.Syncfusion().ReportViewer("report", (ReportViewerModel)ViewData["ReportModel"]).Render();}

    </div>

    @{Html.Syncfusion().ScriptManager().Combine(true).Minify(true).Render();}

</body>

</html>

 

ASPX:

 

<html>
<head runat="server">
    <meta name="viewport" content="width=device-width" />
    <title>ViewReport</title>   
 
   <script src="<%=Url.Content("~/Scripts/jquery-1.6.2.min.js")%>" type="text/javascript"></script>
    <script src="<%=Url.Content("~/Scripts/MicrosoftAjax.js") %>" type="text/javascript"></script>
    <script src="<%=Url.Content("~/Scripts/MicrosoftMvcAjax.js") %>" type="text/javascript"></script> 
</head>
<body>
    <div style="width:100%;height:400px;">    
        <%= Html.Syncfusion().ReportViewer("report", (ReportViewerModel)ViewData["ReportModel"]))%>
    </div>
<%= Html.Syncfusion().ScriptManager() %>
</body>
</html>

 

7.      You can refer the controller information in following forum. Sample also attached with that samples.

http://www.syncfusion.com/support/forums/reportviewer-mvc/106896/SSRS-Support?

 

Please let me know if you have any queries.

 

Regards,

Lingaraj S.

 



NA Narinder April 12, 2013 11:08 AM UTC

hi Lingaraj,

thanx for your reply. 
completed steps provided with empty reportviewer.

my question is regarding adding .rdlc.
i m using visual studio express 2012 for web, how to add a .rdlc file?
do i need to install something else, as there is no option.



LS Lingaraj S Syncfusion Team April 16, 2013 04:23 AM UTC

Hi Narinder,

 

Thanks for your update,

 

You have to use DataSources property to in ReportViewerModel to render RDLC report with ReportViewer. If we provided the value for DataSources then it will be considered as RDLC internally.

 

ReportViewerModel reportModel = new ReportViewerModel();

reportModel.ReportPath = Server.MapPath("~/App_Data/CompanySales.rdlc");

reportModel.DataSources = GetDataSource();

 

public ReportDataSourceCollection GetDataSource()

{

ReportDataSourceCollection dataSources = new ReportDataSourceCollection();

dataSources.Add(new ReportDataSource("Sales", this.GetData()));

return dataSources;

}

 

I think you have to install the Visual Studio Windows express to create RDLC report.

 

Please let me know if you have any queries.

 

Regards,

Lingaraj S.



NA Narinder April 20, 2013 11:52 AM UTC

created a .rdl
intalled patch supplied by you
still no luck.

i think mvc 4 is not supported.
sample sent by you is also giving error.


LS Lingaraj S Syncfusion Team April 22, 2013 10:49 AM UTC

Hi,

 

Regret for the inconvenience. If we have not added the Assembly and Namespace information(what I have explained in 3rd step) in web config then your mentioned exception thrown in ReportViewer. We have attached modified sample.

 

Please let me know if you have any questions.

 

Regards,

Lingaraj S.



MvcReportViewer_928aaaee.zip


NA Narinder April 24, 2013 03:58 AM UTC

hi,

after trying locally, we deployed your sample on http://t.esamadhan.net

output is attached. please look into.


sync_server_error_8bc9d6fd.zip


LS Lingaraj S Syncfusion Team May 7, 2013 09:50 AM UTC

Hi,

 

Please follow-up your queries with your DirectTrac incident for IIS configuration issue.

 

Regards,

Lingaraj S.


Loader.
Up arrow icon