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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Report Viewer in MVC app problem.

Thread ID:





115705 Jan 31,2014 05:15 AM UTC Feb 3,2014 07:02 AM UTC ASP.NET MVC (Classic) 2
Tags: ReportViewer
Asked On January 31, 2014 05:15 AM UTC

I'm trying to create an MVC razor view page with a list of reports on the left and a Report Viewer control on the right.  The reports will be SSRS (.rdlc) reports.  When the user clicks a link on the left, the report viewer should display a certain report.  I haven't found  an example of this type of functionality yet.  All examples I've seen are related to displaying 1 report when the page loads.  Does something like this exist?

In the mean time, I am attempting to even load 1 hard coded report when the page loads.  The result is the page loads, I see the report viewer toolbar, and a continuously spinning icon.  The spinning icon does not go away.  Any ideas what might be going on here?  I appreciate any guidance you might have.

Replied On January 31, 2014 05:54 AM UTC

This is my code for trying to get just one report running (which just gives toolbar and spinning icon).  

Controller Code (In debug I can see that the datasources object is populating with the 3 datasets)

        //this is the default view that gets called
        public ActionResult ProjectReports(string externalstring)
            ViewData["ReportModel"] = this.GetSSRSModel();
            return View();

        public ActionResult SSRS(ReportViewerParams param)
            return new ReportViewerHtmlActionResult(this.GetSSRSModel(), param);

        ReportViewerModel GetSSRSModel()
            string projectId = "1"; //ViewData["ReportProjectId"].ToString();
            ReportViewerModel reportModel = new ReportViewerModel();
            reportModel.ReportPath = Request.PhysicalApplicationPath + "ReportViewer\\Project Schedule Report.rdlc";
            //reportModel.ReportPath = Server.MapPath("~/ReportViewer/Project Schedule Report.rdlc");
            reportModel.EnableVirtualEvaluation = false;

            ReportDataSourceCollection dataSources = new ReportDataSourceCollection();

                //create an sql connection using the default connection string
            SqlConnection cn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["Repository"].ConnectionString);
            SqlCommand cmd = new SqlCommand("", cn);
            SqlDataAdapter da = new SqlDataAdapter();

            //Create the Projects DS
            cmd.CommandText = "Select ProjectID, ProjectNumber + ' - ' + ProjectName as 'ProjectName' from Projects order by 2";
            da.SelectCommand = cmd;
            DataTable dsProjects = new DataTable("Projects");
            //this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Projects", dsProjects));
            dataSources.Add(new ReportDataSource("Projects", dsProjects));
            //END Projects DS

            //Create the GeneralInformation DS
            cmd.CommandText = @"Select P.ProjectNumber,
                           u.FirstName + ' ' + u.LastName + ' ' + u.ContactNumber as 'ProjectManager',
                            from Projects p left join
                           Users u on p.projectmanagerid = u.userid left join
                           Campus c on p.campusid = c.campusid 
                            where P.ProjectID = @ProjectID";
            da.SelectCommand = cmd;
            DataTable dsGeneralInformation = new DataTable("GeneralInformation");
            cmd.Parameters.AddWithValue("@ProjectID", projectId);
            //this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("GeneralInformation", dsGeneralInformation));
            dataSources.Add(new ReportDataSource("GeneralInformation", dsGeneralInformation));
            //END GeneralInformation DS      

            //Create the Schedule DS
            cmd.CommandText = @"SELECT [MilestoneName] as 'Milestone'
                                      ,'' as Comments
                                  FROM [dbo].[ProjectMilestone]
                                  Where ProjectID = @ProjectID and Flag = 1
                                union  all
                                  SELECT [OtherDateName] as 'Milestone'
                                      ,'' as Comments
                                  FROM [dbo].[ProjectOtherDates]
                                  Where ProjectID = @ProjectID and Flag = 1
                                  order by OriginalDate";
            da.SelectCommand = cmd;
            DataTable dsSchedule = new DataTable("Schedule");
            cmd.Parameters.AddWithValue("@ProjectID", projectId);
            //this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Schedule", dsSchedule));
            dataSources.Add(new ReportDataSource("Schedule", dsSchedule));
            //END Schedule DS

            reportModel.DataSources = dataSources;

            return reportModel;

View Code
<script type="text/javascript">
    var myVar;
    $(document).ready(function () {
        var online = window.navigator.onLine;
        if (!online) {

    function StartTimer() {
        myVar = setTimeout(function () {
            alert('Please check your internet connection and try again.');
        }, 7000);

    function StopTimer() {
     @{Html.Syncfusion().ReportViewer("Reports", (ReportViewerModel)ViewData["ReportModel"]).RequestMap("/Reports/SSRS").Render();}


Soundara Rajan S [Syncfusion]
Replied On February 3, 2014 07:02 AM UTC

Hi Brain,


Thanks for using Syncfusion Products.


We have created an incident for this forum, please follow the incident #118694  for more details.


Please let us know, if you have any queries.



Soundara Rajan S



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

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

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