I'm trying to use a reportviewer control, within a razor view, in the mvc 3 framework. The online documentation talks of drag and drop. Any suggestion on how to insert it into the view.
相关问题
- Entity Framework throws exception - Network Relate
- Slow loading first page - ASP.NET MVC
- TextBoxFor decimal
- How to do an inline style with asp.net mvc 3 razor
- How to access the System.ComponentModel.DataAnnota
相关文章
- “Dynamic operations can only be performed in homog
- Change color of bars depending on value in Highcha
- How to get server path of physical path ?
- Breakpoint in ASP.NET MVC Razor view will not be h
- How to define function that returns html in asp.ne
- How to find the exceptions / errors when TryUpdate
- ASP.Net MVC 3: optgroup support in Html.DropDownLi
- A circular reference was detected while serializin
the documentations refers to an ASP.NET application.
You can try and have a look at my answer here.
I have an example attached to my reply.
Another example for ASP.NET MVC3 can be found here.
I am using ASP.NET MVC3 with SSRS 2008 and I couldn't get @Adrian's to work 100% for me when trying to get reports from a remote server.
Finally, I found that I needed to change the Page_Load method in ViewUserControl1.ascx to look like this:
I had been missing the ProcessingMode.Remote.
References:
http://msdn.microsoft.com/en-us/library/aa337091.aspx - ReportViewer
You will not only have to use an asp.net page but
If using the Entity Framework or LinqToSql (if using partial classes) move the data into a separate project, the report designer cannot see the classes.
Move the reports to another project/dll, VS10 has bugs were asp.net projects cannot see object datasources in web apps. Then stream the reports from the dll into your mvc projects aspx page.
This applies for mvc and webform projects. Using sql reports in the local mode is not a pleasent development experience. Also watch your webserver memory if exporting large reports. The reportviewer/export is very poorly designed.
There's a MvcReportViewer helper in NuGet.
http://www.nuget.org/packages/MvcReportViewer/
And this is the details:
https://github.com/ilich/MvcReportViewer
I have using this. It works great.
It is possible to get an SSRS report to appear on an MVC page without using iFrames or an aspx page.
The bulk of the work is explained here:
http://geekswithblogs.net/stun/archive/2010/02/26/executing-reporting-services-web-service-from-asp-net-mvc-using-wcf-add-service-reference.aspx
The link explains how to create a web service and MVC action method that will allow you to call the reporting service and render result of the web service as an Excel file. With a small change to the code in the example you can render it as HTML.
All you need to do then is use a button to call a javascript function that makes an AJAX call to your MVC action which returns the HTML of the report. When the AJAX call returns with the HTML just replace a div with this HTML.
We use AngularJS so my example below is in that format, but it could be any javascript function
And the Action Method - mainly taken from the above link...
So the result is that you get to pass parameters to an SSRS reporting server which returns a report which you render as HTML. Everything appears on the one page. This is the best solution I could find
This is a simple task. You can follow the following steps.
Create a Class ReportData and add it to the Reports folder. Add the following code to the Class.
Add another Class and name it ReportBasePage.cs. Add the following code in this Class.
Add ScriptManager to the ReportView.aspx page. Now add a Report Viewer to the page. In report viewer set the property AsyncRendering="false". The code is given below.
Add two NameSpace in ReportView.aspx.cs
Change the System.Web.UI.Page to ReportBasePage. Just replace your code using the following.
Add a Folder to the Reports Folder and name it Report. Now add a RDLC report to the Reports/Report folder and name it ClosingInventory.rdlc.
Now add a Controller and name it ReportController. In the controller add the following action method.
Add a view page click on the ReportViewer Controller. Name the view page ReportViewer.cshtml. Add the following code to the view page.
Add an Iframe. Set the property of the Iframe as follows
Add Following JavaScript to the viewer.
Web.config file add the following key to the appSettings section
In system.web handlers Section add the following key
Change your data source to your own. This solution is very simple and I think every one will enjoy it.