如何将数据从网格视图传递给Viewer? [英] c# - How to pass the data from grid view to report Viewer?

查看:159
本文介绍了如何将数据从网格视图传递给Viewer?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个网格视图,我在其中添加了几个项目这是在它,现在我需要将这些项目移动到一个报告查看报告。

我不知道该怎么做,最好是将所有数据网格因为它们是不同的值(例如,是与各种输出相对应的项目)并且进行查询并将数据提交给报告,所以对于法衣或拾取每个输出的项目ID,那么最可行的是什么? ?

解决方案

假设您处于本地处理模式,因为没有提供进一步的信息。



ReportDataSource 本地模式向ReportViewer控件提供数据的方式。
http://msdn.microsoft。 com / en-us / library / ms251736(v = vs.90).aspx

现在在MSDN的GridView Page上,
我发现 GridView.DataSourceObject实现了IDataSource 。 (这是创建ReportDataSource的参数选项)。



这意味着您应该能够创建ReportDataSource 以提供给您的ReportViewer控件,只需从GridView 中创建ReportDataSource(Rds)就可以,

  ReportDataSource Rds = new ReportDataSource DataSetName,GridView.DataSourceObject); 


Staff gave some research, but still could not understand how to do, I have little knowledge in C #.

I have a grid view where I add several items that were in it, now I need to move these items to a report View report.

I do not know how to do, it would be better to pass all data grid for vestments or pick up the item ids of each output as they are distinct values ​​(eg, are items that correspond to various outputs) and make a query and bring the data to the report ... what would be the most feasible??

解决方案

Assuming you're in Local-Processing Mode since no further information was supplied.

ReportDataSource is how you supply data to a ReportViewer Control in local-mode. http://msdn.microsoft.com/en-us/library/ms251736(v=vs.90).aspx

Now after going to GridView Page on MSDN, I found that GridView.DataSourceObject implements IDataSource. (Which is a parameter option for creating a ReportDataSource).

Meaning you should be able to create a ReportDataSource to supply to your ReportViewer Control, just create the ReportDataSource (Rds) from your GridView like so,

ReportDataSource Rds = new ReportDataSource("DataSetName", GridView.DataSourceObject);

这篇关于如何将数据从网格视图传递给Viewer?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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