xtrareports-18125-web-reporting-asp-net-mvc-reporting-end-user-report-designer-in-asp-net-mvc-applications-quick-start-add-an-end-user-report-designer-to-an-aspnet-mvc-application.md
This topic configures an ASP.NET MVC project to use DevExpress controls, add the Report Designer control to a view page, and display a report.
If you add the Document Viewer to an existing application, start with the following section: .
Create a new project in Visual Studio and select ASP.NET Web Application (.NET Framework) on the start page as a project template:
Specify the project name, location and target framework:
In the next page, select MVC as a project template:
IInvoke the DevExpress ASP.NET Project Wizard to update the existing project. To do this, click the Extensions menu item in Visual Studio and select DevExpress → ASP.NET Controls → Run Wizard to Update Project :
Click Update Project.
The Wizard updates the Web.config file with DevExpress project settings and adds references to DevExpress assemblies.
Add the following section to the Web.config file to automatically register third-party scripts and DevExtreme libraries:
Add the following code to the _Layout.cshtml file to include Reporting scripts and stylesheets, and make them available in all views:
Comment out the line that registers the jQuery scripts in the _Layout.cshtml file:
Right-click the project in the Solution Explorer and select Add | New Folder from the context menu. Rename the created folder to Reports.
Right-click the Reports folder and select Add | New Item from the context menu. In the invoked Add New Item dialog, click the Reporting tree node and select DevExpress v25.2 Report.
Select the Blank report type in the invoked Report Wizard.
The Report Designer displays the newly created blank report. Save the report and close the designer.
Rebuild the project.
Review the following help topic for more information: Add a New Report in Visual Studio.
You can register the ASPxHttpHandlerModule handler to process resources and requests. For more information, review the following help topic: Register HTTP Handlers.
An alternative method is to implement MVC controllers to handle the requests. To do this, follow the steps below:
Add a reference to the DevExpress.XtraReports.v25.2.Web assembly to resolve the base controller type.
Implement default controllers (Viewer, Designer, and Query Builder) that process the Report Designer requests. To do this, in the Controllers folder, create a new file (ReportingControllers.cs) with the following content:
Create a ReportDesignerModel model and specify all the necessary parameters on the server:
Implement HomeController as follows:
Implement and register the IReportProvider service to translate a report string identifier to a report instance.
Replace the Index.cshtml page content with the following code snippet:
Add a reference to the DevExpress.XtraReports.v25.2.Web.WebForms assembly.
Add the following line to the Global.asax.cs file after all service registration methods:
Run the project and observe the result. If the Report Designer is not displayed or an error message is shown, review the following help topics to diagnose and remedy the problem:
Watch Video: Reporting: ASP.NET MVC End-User Report Designer (YouTube)
See Also