We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to pass LightSwitchHtml application data to ReportViewer datasource

Platform: LightSwitch HTML |
Control: ReportViewer

How to pass LightSwitchHtml application data to ReportViewer datasource

This article describes how to pass application data to ReportViewer datasource in LightSwitch Application. You can also refer to the Getting Started with JavaScript ReportViewer from the User Guide, available in the following link:



Passing application data to ReportViewer:

You can get the LSHTML application data and passed to ReportViewer using the following code sample.

    public class ReportAPIController : ApiController, IReportController
        public object PostReportAction(Dictionary<string, object> jsonResult)
            return ReportHelper.ProcessReport(jsonResult, this);
        public object GetResource(string key, string resourcetype, bool isPrint)
            return ReportHelper.GetResource(key, resourcetype, isPrint);
        public void OnInitReportOptions(ReportViewerOptions reportOption)
            var hostedPath = System.Web.HttpContext.Current.Server.MapPath("~/");
            var rdlPath = hostedPath + "bin\\LSSSRSDemo.Server\\ReportTemplate\\" + reportOption.ReportModel.ReportPath;
            reportOption.ReportModel.ReportPath = rdlPath;
        public void OnReportLoaded(ReportViewerOptions reportOption)
            if (reportOption.ReportModel.ReportPath.Contains("TicketReport"))
                reportOption.ReportModel.DataSources.Add(new ReportDataSource { Name = "ETickets", Value = GetTickets() });
        public object GetTickets()
            using (ServerApplicationContext ctx = ServerApplicationContext.CreateContext())
                var tickets = ctx.DataWorkspace.ApplicationData.TicketsSet.GetQuery()
                return tickets;


Demo Sample

You can download the Demo Sample from the following link.


Further References

You can find documentation and demo samples for JavaScript ReportViewer Control from the following link.



You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile