Overview
- 2 minutes to read
This topic describes the details of the Report Designer implementation and provides sample code illustrating its declaration in ASP.NET MVC.
Implementation Details
The Report Designer functionality in ASP.NET MVC is provided by the ReportDesignerExtension class.
An instance of this class can be accessed via the ExtensionsFactory.ReportDesigner helper method, which is used to add a Report Designer extension to a view. This method’s parameter provides access to the Report Designer settings provided by the ReportDesignerSettings class, allowing you to completely customize the extension.
The client-side counterpart of the Report Designer is provided by the MVCxClientReportDesigner class.
Declaration
The following code demonstrates how to add a Report Designer to a project and open a report in it.
View code - “Index”:
@model DevExpress.XtraReports.UI.XtraReport
@Html.DevExpress().ReportDesigner(settings => {
settings.Name = "designer";
settings.SaveCallbackRouteValues = new { Controller = "Home",
Action = "ReportDesignerSaveLayout" };
}).Bind(Model).GetHtml()
Controller (“Home”):
public class HomeController : Controller {
public ActionResult Index() {
return View(new MyXtraReport());
}
[HttpPost]
public ActionResult ReportDesignerSaveLayout() {
byte[] reportLayout = ReportDesignerExtension.GetReportXml("designer");
}
}
To allow users to save reports to a common storage, you can do one of the following.
- Specify the ReportDesignerSettings.SaveCallbackRouteValues property (as in the example above).
- Register a custom ReportStorageWebExtension. In this case, a user is allowed to open multiple reports at once and edit subreports.