[]
        
(Showing Draft Content)

Using C1 MVC ReportViewer Template

This topic describes how to view a FlexReport in your MVC application using C1 MVC ReportViewer template. C1 MVC ReportViewer template provides the following options using which you can preview your report in FlexViewer;

  • Report in other report service

    When working with ASP.NET Core applications, you can only use the Report in other report service option in the C1 MVC Report Viewer template to view the report in FlexViewer. You can use this option when your report is hosted on the Web API Service project.

  • Report in ActiveReprots report service

    When working with ASP.NET Core applications, you can use the Report in ActiveReports report service option in the C1 MVC Report Viewer template to view the ActiveReports in FlexViewer. You can use this option only for the ActiveReports that are hosted on a server.

Working with C1 MVC ReportViewer

The below steps demonstrates how you can use C1 MVC ReportViewer wizard to view a report in FlexViewer control using Visual Studio template.

  1. Register Resources
  2. Add Controller

type=note

Note: The C1 ASP.NET Core MVC Application template for ASP.NET MVC Edition automatically registers the required resources, and adds the relevant references and packages to your application. Therefore, you can directly use the C1 MVC ReportViewer template if your application is created using ComponentOne template.

Step 1: Register Resources

Complete the following steps to register the required resources for using ASP.NET MVC FlexViewer control:

  1. From the Solution Explorer, open the folders Views | Shared.

  2. Double click _Layout.cshtml to open it.

  3. Add the following code between the <head></head> tags.

    <c1-styles />
    <c1-scripts>
    <c1-flex-viewer-scripts />
    </c1-scripts>
    

For more information on how to register resources for FlexViewer, refer to Registering Resources.

Step 2: Add Controller

Complete the following steps to add controller to your application.

  1. In the Solution Explorer, right click the folder Controllers.
  2. From the context menu, select Add | Controller... . The Add Scaffold dialog appears.
  3. Complete the following steps in the Add Scaffold dialog:
    1. Select the Controller tab towards left, and then select MVC Controller - Empty.
    2. Click Add, and then set a name for the controller. (for example: ReportController)
    3. Click Add.

A new controller is added to the application within the folder Controllers.