Hello,
I'm new using Syncfusion.
I'm trying to make an example following documentation
Load RDLC Reports
https://help.syncfusion.com/aspnetmvc/reportviewer/getting-started#load-rdlc-reports
This is my view.
@using Syncfusion.JavaScript
@using Syncfusion.MVC.EJ
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
<div style="width:100%">
@(Html.EJ().ReportViewer("viewer").ProcessingMode(Syncfusion.JavaScript.ReportViewerEnums.ProcessingMode.Local)
.ReportPath("~/Reports/MemoriasDeCalculoCantidades.rdlc")
.ReportServiceUrl(VirtualPathUtility.ToAbsolute("~/api/ReportApi"))
.DataSources(ds => ds.Name("DataSetCapitulo").Value(ViewData["Capitulo"]).Add()))
</div>
@section styles{
}
@section scripts{
<script src="~/Scripts/Reportes/jquery.easing.min.js"></script>
<script src="~/Scripts/Reportes/ej.web.all-latest.min.js"></script>
<script src="~/Scripts/Reportes/ej.unobtrusive-latest.min.js"></script>
}
This is my controller
using Interventorias.Entities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Interventorias.Controllers
{
public class ReportController : Controller
{
private InterventoriasEntities db = new InterventoriasEntities();
// GET: Report
public ActionResult index()
{
ViewData["Capitulos"] = db.sp_capitulos(1);
return View();
}
}
}
This is my api
using Syncfusion.EJ.ReportViewer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Web.Http;
namespace Interventorias.api
{
public class ReportApiController : ApiController, IReportController
{
//Post action for processing the rdl/rdlc report
public object PostReportAction(Dictionary<string, object> jsonResult)
{
return ReportHelper.ProcessReport(jsonResult, this);
}
//Get action for getting resources from the report
[System.Web.Http.ActionName("GetResource")]
[AcceptVerbs("GET")]
public object GetResource(string key, string resourcetype, bool isPrint)
{
return ReportHelper.GetResource(key, resourcetype, isPrint);
}
//Method will be called when initialize the report options before start processing the report
public void OnInitReportOptions(ReportViewerOptions reportOption)
{
//You can update report options here
}
//Method will be called when reported is loaded
public void OnReportLoaded(ReportViewerOptions reportOption)
{
//You can update report options here
}
}
}
This is my Global.asax.cs
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
System.Web.Mvc.ModelBinders.Binders.Add(typeof(decimal), new DecimalModelBinder());
System.Web.Mvc.ModelBinders.Binders.Add(typeof(decimal?), new DecimalModelBinder());
System.Web.Http.GlobalConfiguration.Configuration.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional });
}
}
And this is the error that occurs:
[HttpException]: The controller for path '/api/ReportApi/PostReportAction' was not found or does not implement IController.
en System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(RequestContext requestContext, Type controllerType)
en System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName)
en System.Web.Mvc.MvcHandler.ProcessRequestInit(HttpContextBase httpContext, IController& controller, IControllerFactory& factory)
en System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state)
en System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state)
en System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
en System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
en System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Thank you very much,
Sorry for my English