ASP.NET MVC Controls
View Reports using report service

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, right-click the Report folder, and then select Add | New Item... to open the Add New Item dialog.
  2. Under Installed | Templates, select Visual C# | Web | C1 ReportViewer View Page to open the C1 MVC ReportViewer dialog.
  3. In the C1 MVC ReportViewer dialog, select Report in other report service option.

  4. In the Service URL field, enter a Web API Service URL to access the reports. For example, http://demos.componentone.com/ASPNET/c1webapi/4.0.20171.91/api/report.
  5. In the Report Path field, specify the report root location where the report is stored.
  6. 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.
  7. 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>
        @Html.C1().Styles()
            @Html.C1().Scripts().FlexViewer()
    </head>
    <body>
    @(Html.C1().ReportViewer().ServiceUrl(@"http://demos.componentone.com/ASPNET/c1webapi/4.0.20171.91/api/report")
    .FilePath(@"ReportsRoot/FlexCommonTasks/FlexCommonTasks.flxr").ReportName(@"Simple List"))
    </body>
    
  1. From the Solution Explorer, right click the folder Views and select Add | New Folder.
  2. Name the new folder. Provide the same name as the name of your controller, minus the suffix Controller (in our example: Report).
  3. Right-click the Report folder, and then select Add | New Item... to open the Add New Item dialog.
  4. Under Installed | Templates, select .NET Core | C1 ReportViewer View Page (ASP.NET Core) to open the C1 MVC ReportViewer dialog.


  5. In the Service URL, enter the Web API Service URL to access the report file. For example, http://demos.componentone.com/ASPNET/c1webapi/4.0.20171.91/api/report.
  6. In the Report Path field, specify the report root location where the reports are 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="http://demos.componentone.com/ASPNET/c1webapi/4.0.20171.91/api/report"></c1-report-viewer>
    </body>
    

 

 


Copyright © GrapeCity, inc. All rights reserved.

Product Support Forum |  Documentation Feedback