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.
Lingaraj S.
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.
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.
Hi,
Please follow-up your queries with your DirectTrac incident
for IIS configuration issue.
Regards,
Lingaraj S.