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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

how to use report viewer in asp.net mvc

Thread ID:

Created:

Updated:

Platform:

Replies:

108281 Apr 11,2013 11:26 AM UTC May 7,2013 09:50 AM UTC ASP.NET MVC (Classic) 7
loading
Tags: ReportViewer
Narinder
Asked On April 11, 2013 11:26 AM UTC

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

Lingaraj S [Syncfusion]
Replied On 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.

 


Narinder
Replied On 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.


Lingaraj S [Syncfusion]
Replied On 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.


Narinder
Replied On 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.

Lingaraj S [Syncfusion]
Replied On 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

Narinder
Replied On 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

Lingaraj S [Syncfusion]
Replied On May 7, 2013 09:50 AM UTC

Hi,

 

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

 

Regards,

Lingaraj S.


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

;