combit List & Label 27 - .NET Help
Programming Introduction / Examples / Web Reporting / Use of the Web Report Viewer
In This Topic
    Use of the Web Report Viewer
    In This Topic

    The Web Report Viewer supports all common browser types. Thus, it can be used on clients with different operating systems. It allows interactive input through drilldown and report parameters.

    Requirements

    Integration - Create new Controller

    Then create a new controller as usual - in the following the name MyWebReportViewerController is used as an example. Derive the controller from the WebReportViewerController class:

    ...
    public class MyWebReportViewerController : WebReportViewerController
    ...
    
    ...
    Public Class MyWebReportViewerController
            Inherits WebReportViewerController
    ...
    

     

    Integration - Override important Methods

    Then implement the two abstract methods OnProvideListLabel and OnProvideRepository. Pass your List & Label instance with matching data source and temporary export path repectively the Repository to be used in the respective arguments provided.

    ...
    public override void OnProvideListLabel(ProvideListLabelContext provideListLabelContext)
    {
        // Create List & Label object
        ListLabel ll = new ListLabel();
        ll.LicensingInfo = "<ToDo: insert your license here>"
    
        // Define datasource
        var dataSource = GetDataProvider(provideListLabelContext.RepositoryItemId);
        ll.DataSource = dataSource;
    
        // The Web Report Viewer requires a directory for temporary files. Some minutes after a Web Report Viewer is closed, these files will be deleted automatically
        provideListLabelContext.ExportPath = Server.MapPath("~/App_Data/TempFiles");
    
        // Return configured List & Label object
        provideListLabelContext.NewInstance = ll;
    }
    
    public override void OnProvideRepository(ProvideRepositoryContext provideFileRepositoryContext)
    {
        provideFileRepositoryContext.Repository = GetRepository();
    } 
    ...
    
    ...
    Public Overrides Sub OnProvideListLabel(ByVal provideListLabelContext As ProvideListLabelContext)
    
        ' Create List & Label object
        Dim ll As ListLabel = New ListLabel()
        ll.LicensingInfo = "<ToDo: insert your license here>"
    
        ' Define datasource
        Dim dataSource = GetDataProvider(provideListLabelContext.RepositoryItemId)
        ll.DataSource = dataSource
    
        ' The Web Report Viewer requires a directory for temporary files. Some minutes after a Web Report Viewer is closed, these files will be deleted automatically
        provideListLabelContext.ExportPath = Server.MapPath("~/App_Data/TempFiles")
    
        ' Return configured List & Label object
        provideListLabelContext.NewInstance = ll
    
    End Sub
    
    Public Overrides Sub OnProvideRepository(ByVal provideFileRepositoryContext As ProvideRepositoryContext)
    
        provideFileRepositoryContext.Repository = GetRepository()
    
    End Sub
    ...
    

     

    In addition, the List & Label license key (see also LicensingInfo) must be specified.

     

    Integration - .NET Switch

    The further procedure differs for .NET Core 3.1/.NET 5/.NET 6 and .NET 4.x.

     

    .NET Core 3.1/.NET 5/.NET 6:

    In the startup.cs file, add the following lines to the end of the Configure method:

    ...
    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
        // do some other stuff here
        // ...
    
        app.UseWebReportViewer();
    }
    ...
    

     

    .NET 4.x:

    In the global.asax.cs/global.asax.vb file, add the following line before the RouteConfig.RegisterRoutes() call:

    ...
    WebReportViewerConfig.RegisterRoutes(RouteTable.Routes);
    ...
    
    ...
    WebReportViewerConfig.RegisterRoutes(RouteTable.Routes)
    ...
    

     

    Using Web Report Viewer

    The configuration is now complete. Now the Web Report Viewer can be inserted and used in the desired view as follows:

    ...
    @using combit.Reporting.Web
    @{
        Layout = null;
        string repositoryId = Request.QueryString["reportRepositoryID"];
        if (!String.IsNullOrEmpty(repositoryId))
        {
            repositoryId = repositoryId.Replace("repository://{", "").Replace("}", "");
        }
    }
    <!DOCTYPE html>
    @Html.WebReportViewer("Web Report Viewer", repositoryId)
    ...
    

     

    Further

    The List & Label installation contains corresponding ASP.NET examples that show the use of the Web Report Viewer in detail both under .NET Core and under .NET 4.x.