I am a new user and trying to replace MS ReportViewer.
I have a webforms solution using VS2013.
I followed the online documentation "Create your first ReportViewer in ASP.NET"
I use rdlc reports localmode, but the reportviewer is not showing up.
Do I have to do something else?
WebForm CodeBehind
var prodlist = new Reports();
List<ReportDataSource> rptDatasources = new List<ReportDataSource>();
ReportDataSource rptDatasource = new ReportDataSource();
rptDatasource.Name = "DataSet1";
rptDatasource.Value = prodlist.GetRptAlunosLinq(2015);
rptDatasources.Add(rptDatasource);
ReportViewer2.DataSources = rptDatasources;
ReportApiController
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
}
}
Global.asax
public class Global : HttpApplication
{
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
AreaRegistration.RegisterAllAreas();
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
System.Web.Http.GlobalConfiguration.Configuration.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional });
}
}