ASP.NET Core MVC Controls | ComponentOne
Working with Controls / FlexViewer / ReportViewer / Using C1 MVC ReportViewer Template / View Reports using report service
In This Topic
    View Reports using report service
    In This Topic

    To view a report that is stored on a report service, you need to configure your MVC application. Complete the following steps to add view page to your application. For more information about using Report Viewer, see Using C1 ReportViewer Template.

    1. Under Views, add a folder named Report.
    2. Right-click the Report folder and select Add | New Item... to open the Add New Item dialog.
    3. Under Installed | Templates, select Visual C# | ASP.NET Core | C1 ReportViewer View Page (ASP.NET Core) and click Add to open the C1 MVC ReportViewer dialog. Note that only ASPNET WebAPI Core 5 and 6 are support for FlexReport and FlexViewer.
    4. In the C1 MVC ReportViewer dialog, select Report in other report service option.

    5. In the Service URL field, enter a Web API Service URL to access the reports. For example, https://developer.mescius.com/componentone/demos/aspnet/5/c1webapi/latest/api/report.
    6. In the Report Path field, specify the report root location where the report is stored.
    7. Click Connect to establish a connection to the WebApi server. Once you are connected to the WebApi server, Reports section displays all the report names.
    8. Select a report from the list and, then click OK to create Index.cshtml view page.
      Index.cshtml
      Copy Code
      <head>
      <title>C1 MVC ReportViewer</title>
      <c1-styles />
      <c1-scripts>
      <c1-flex-viewer-scripts /></c1-scripts>
      </head>
      <body>
      <c1-report-viewer file-path="ReportsRoot/FlexCommonTasks/FlexCommonTasks.flxr" report-name="Simple List" 
      service-url="https://demos.componentone.com/ASPNET/c1webapi/4.0.20171.91/api/report"></c1-report-viewer>
      </body>
      
    Note: If the report is using any local database file, you need to copy that database file to the App_Data folder. The connection string of the report should point to the database file in this folder. This can be updated in the report file itself by opening it in XML editor inside Visual Studio like this:
    <DataSources>  
    <DataSource>  
    <Name>Main</Name>
    <DataProvider>OLEDB</DataProvider>
    <ConnectionString>Provider=SQLNCLI11;Integrated Security=SSPI;
        Data Source=(localdb)\\v11.0;Initial File Name=|DataDirectory|\\C1Demo.mdf;Persist Security Info=False
    </ConnectionString>
    <RecordSource>Employees</RecordSource>  
    </DataSource>  
    </DataSources>