RDLC报告与动态绑定的数据源分页 [英] RDLC Report not paging with dynamically bound datasource

查看:507
本文介绍了RDLC报告与动态绑定的数据源分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个RDLC报告,我想我自己的自定义类的列表绑定到作为数据源。

I have a rdlc report I want to bind a list of my own custom class to as a data source.

我已经使用了一些code推荐上的本网站建立数据表

I've used some code recommended on this site to build the DataTable

这个作品真的很好

     //convert my list of Invoices to a DataTable
     var dt = invoices.CopyToDataTable(dataTable, LoadOption.PreserveChanges);
     //Setup a new DataSource
     var rds = new ReportDataSource {Name = "ReportDataSet", Value = dt};
     //Add that datasource to my ReportViewer
     rvSampleInvoice.LocalReport.DataSources.Add(rds);
     //Map my report path, etc
     rvSampleInvoice.LocalReport.ReportPath = Server.MapPath("etc");

这一切工作正常,当我加载我的网页,报告显示,但它只有一个2页。第一个是在我的发票收集的第一个条目,当我点击下一页,这是一个空白页。
我添加一个GridView到页面,并绑定数据表(DT),它和它显示为一个漂亮的表头行和20行数据。

This all works fine, when I load my page, the report shows, but it only has one 2 pages. the first is the first entry in my invoices collection, and when I click next page, it's a blank page. I've added a gridview to the page, and bound the DataTable (dt) to it and it displays as a nice table with a row of headers and 20 rows of data.

我想知道如果我有什么不对有关如何将RDLC绑定到我的发票清单

I'm wondering if I've got something wrong on how to bind a RDLC to my List of Invoices

推荐答案

<一个href=\"http://stackoverflow.com/questions/8389884/how-do-you-create-a-report-rdlc-that-shows-1-record-per-page\">This SO回答已经解决了这个问题。有一定有这样做的更好的办法,因此,如果有人知道一个更好的方式来对一个结果集多个页面,让我知道

This SO answer has has solved the issue. There's gotta be a better way of doing this, so if anyone knows a better way to have multiple pages for one result set, let me know

更新:

好吧,我会解释我所学到现在更多RDLCs为未来的考古学家。你不能只是拖放数据到一个页面,绑定的物品清单,并期望它复制你所做的样品页面然而多次有您的列表项。
你需要拖动表格到报表并勾选在做方案我联系到分页符选项。然后舒展表跨页,添加了一堆的行和列。你在你的页面所需的单元格的填充。
这需要一堆细胞融合和拉伸得到它看起来就是我想要的,所以如果有一个更好的办法,有人请一个职位。

Ok, I'll explain what I've learnt now more about RDLCs for future archeologists. You can't just drag and drop data into a page, bind a list of items and expect it to duplicate the sample page you've made however many times there are items in your list. You need to drag a table into the report and tick the "page break" option in the SO solution I linked to. Then stretch the table across the page, add a bunch of rows and columns. The fill in the cells you want in your page. It takes a bunch of cell merging and stretching to get it to look the way I want, so if there's a better way, someone please make a post.

这篇关于RDLC报告与动态绑定的数据源分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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