- Home
- Forum
- ASP.NET MVC (Classic)
- Report Viewer in MVC app problem.
Starting in 2019, the Reporting control is no longer included in Essential Studio®. If you're experiencing issues with the Syncfusion� Reporting Platform, Report Viewer, Report Designer, or Report Writer, we recommend migrating to Bold Reports, our dedicated reporting platform.
Bold Reports offers a comprehensive suite of tools and features for all your reporting needs, and we will help you make a smooth transition from the discontinued control. Our support team at https://support.boldreports.com/ is here to assist you with any questions or difficulties you may encounter during the migration process.
We thank you for choosing Syncfusion� and appreciate your understanding.
Bold Reports offers a comprehensive suite of tools and features for all your reporting needs, and we will help you make a smooth transition from the discontinued control. Our support team at https://support.boldreports.com/ is here to assist you with any questions or difficulties you may encounter during the migration process.
We thank you for choosing Syncfusion� and appreciate your understanding.
Report Viewer in MVC app problem.
Hi,
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.
SIGN IN To post a reply.
2 Replies
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();
}
[AcceptVerbs(HttpVerbs.Post)]
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");
da.Fill(dsProjects);
//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,
P.ProjectName,
u.FirstName + ' ' + u.LastName + ' ' + u.ContactNumber as 'ProjectManager',
c.CampusName,
p.ProjectDescription
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.Clear();
cmd.Parameters.AddWithValue("@ProjectID", projectId);
da.Fill(dsGeneralInformation);
//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'
,[OriginalDate]
,[ProjectedDate]
,[ActualDate]
,'' as Comments
FROM [dbo].[ProjectMilestone]
Where ProjectID = @ProjectID and Flag = 1
union all
SELECT [OtherDateName] as 'Milestone'
,[OriginalDate]
,[ProjectedDate]
,[ActualDate]
,'' as Comments
FROM [dbo].[ProjectOtherDates]
Where ProjectID = @ProjectID and Flag = 1
order by OriginalDate";
da.SelectCommand = cmd;
DataTable dsSchedule = new DataTable("Schedule");
cmd.Parameters.Clear();
cmd.Parameters.AddWithValue("@ProjectID", projectId);
da.Fill(dsSchedule);
//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) {
StartTimer();
}
});
function StartTimer() {
myVar = setTimeout(function () {
alert('Please check your internet connection and try again.');
StopTimer();
}, 7000);
}
function StopTimer() {
clearTimeout(myVar);
}
</script>
...
@{Html.Syncfusion().ReportViewer("Reports", (ReportViewerModel)ViewData["ReportModel"]).RequestMap("/Reports/SSRS").Render();}
@{Html.Syncfusion().ScriptManager().Combine(true).Minify(true).Render();}
SR
Soundara Rajan S
Syncfusion Team
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
SIGN IN To post a reply.
- 2 Replies
- 2 Participants
- Jan 31, 2014 05:15 AM UTC
- Feb 3, 2014 07:02 AM UTC