在ASP.NET 4的ReportViewer使用对象数据源 [英] Using Object data source in ASP.NET 4 ReportViewer

查看:164
本文介绍了在ASP.NET 4的ReportViewer使用对象数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OK,我想我惹毛了这里...
我觉得这应该是超级简单,但我无法弄清楚如何做到这一点。

OK, I think I'm getting mad here... I thought this should be super simple, but I just can't figure out how to do that.

这是我想要做的事:
我要创建使用ASP.NET 4(VS 2010)ReportViewer控件的RDLC报告,并作为其数据源,使用一类具有一些属性。
我什么都试过了我能想到的,但我实在不明白这一点。所有的文档,我发现这个对象应该出现在网站上的数据源窗格中的状态,但我不能让它出现在那里。
我想类的字段出现在报告desiger这样我就可以使用它们 - 但我不能做,要么。
使用设计,我只能定义新的数据集 - !我不希望使用数据集,但业务对象

This is what I'm trying to do: I want to create an rdlc report using the ReportViewer control in ASP.NET 4 (VS 2010), and, as its datasource, use a class with some properties. I tried everything I can think of, but I just can't figure this out. All the docs I found state that the object should appear in the DataSource pane of the website, but I can't make it appear there. I would like the fields of the class to appear in the report desiger so I can use them - but I can't do that either. Using the designer, I can only define new dataset - I don't want to use dataset, but business objects!

所以 - 我该怎么办呢?我一定要使用某种DataSource控件的?我怎样才能使报告设计师了解业务对象?

So - how can I do that? Do I have to use some kind of DataSource control? How can I make the report designer know about the business object?

谢谢!

MEMI

推荐答案

你遵循的本教程?结果
你必须做的一切是:

did you follow this tutorial?
everything you must do is:


  • 定义DTO类或使用EF4生成(例如)

  • 有一些方法定义你的业务类(如GETALL ...)

  • 构建解决方案(这很重要)

  • define your DTO classes or generate it using EF4 (for example)
  • define your business classes with some methods (like GetAll...)
  • build your solution (that's important)

现在从你的报表设计器,您可以选择从业务类方法的数据集,将它从DTO类降场结果
当你选择该报告中的ReportViewer显示,数据源对象将自动为你添加

now from your report designer you can choose methods from business classes as dataset and drag and drop field from the DTO classes
when you choose that report to display in the reportviewer, the datasource object will be added for you

这篇关于在ASP.NET 4的ReportViewer使用对象数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆