Reportviewer data source in asp.net-mvc

How to integrate ReportViewer into asp.net MVC project?

I want to add MVCProject.Model namespace business objects. ReportViewer enables DataSet business objects.

Can I select a different data source, for example LinqDataSource , or a Direct object for LINQ-to-SQL class objects?

What would be the best solution for adding reports to an MVC project?

+6
asp.net-mvc reporting-services reportviewer
source share
4 answers

An alternative way to do this is to create a report on the report server and then transfer it to the mvc application as a PDF.

+2
source share

I got an idea that has not been tested, but can work. 1- Place control of viewing reports on a standard page of an ASP.Net web form (for example, ReportViewer.aspx) 2- Under MVC, add an iframe linking to this page ReportViewer.aspx 3- Passing parameters to a page using sessions or query strings

Let me know if it works.

+2
source share

It will be hard. First, you need a ViewState, so you will need to place the report on a regular WebForms page. This is not so bad because WebForms and MVC work side by side.

The hard part is tied to real IEnumerable objects, and not to ObjectDataSources objects with fake balance.

The first step is to create a report data model. You can do this in code, with queries, no matter what you want. A structure similar to this one (but obviously much larger) is typical:

 public class ReportSource { public Floogle[] Floogles { get; set; } } public class Floogle { public Doodad[] Doodads { get; set; } public string Text { get; set; } } public class Doodad { public int Number { get; set; } } 

The trick is to use the BindingSource control in your report and set the DataSource property to typeof(ReportSource) - yes, the data source is the type of your report model.

When developing a report, you will not get much wealth, but you can do it.

For third-party reporting solutions, we found Telerik to be the best option.

+1
source share

I have a small project that I wrote in Codeplex, which is a mvc project with a report.

http://mvctaskmanagement.codeplex.com/

Basically, since I am doing dev on an XP box, my web form should have been ported to a separate project. Since I have proj, I'm stuck there.

From there, I call my report through the ajax post, taking off the parameters on the report page, and then transferring it to the same level of service that is used to create the preview.

Good luck

0
source share

All Articles