Create a LightSwitch HTML Application
This section explains you how to configure a ReportViewer component in LightSwitch HTML application. As ReportViewer uses WebApi to process the report file, you can also learn how to create WebApi services to process the report for the ReportViewer. In the following example, the ReportViewer component displays the report from SSRS Server.
Figure 1: Project Creation Wizard
Add Syncfusion LightSwitch HTML Extensions
The following steps help you to add Syncfusion LightSwitch HTML Extension in the sample application.
Figure 2: Properties Page
Select Extensions tab and add Syncfusion LightSwitch HTML extensions by selecting Web for HTML LightSwitch and DataVisualization for HTML LightSwitch.
Figure 3: Select Syncfusion Extensions
Add Scripts and Styles
You have to add the following script files and CSS files in the default.html page of the HTMLClient project.
Note: Use the following code example while adding scripts and styles.
Add ReportViewer Template Screen
The following steps help you to add the ReportViewer Template Screen in HTMLClient.
Figure 4: ReportViewer Template Screen
Figure 5: Choose New Custom Control
Figure 6: EJ ReportViewer Custom Control
Figure 7: Edit Render Code Option
Add WebApi Controller to the Server
LightSwitch HTML ReportViewer uses WebApi services to process the report file and also process the request from control.
You can add the following assembly references to Server project for WebApi and ReportViewer.
Note: Refer to System.Web.Http, System.Web.WebHost, System.Net.Http.WebRequest and System.Net.Http.Formatting dlls from ASP.NET WebApi nuget package.
Create WebApi Controller
Figure 8: Add SSRSReportController
The ApiController inherits the IReportController and adds the following code example to its methods definition to process the report file. The interface IReportController contains required actions and helper methods declaration to process the report. The ReportHelper class contains helper methods that help to process Post/Get request from control and return the response to control.
Figure 9: Adding Global.asax
Run the Application
Run the sample application and you can see the ReportViewer on the page as displayed in the following screenshot.
Figure 10: ReportViewer with SSRS Report
You can download the Demo Sample from the following link.
SSRS Report Sample
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:||.NET Framework:|
or the page will be automatically redirected to sign-in page in 10 seconds.