绑定list LoadDocument需要引用那个程序集
提示缺少引用LoadDocument是Winform的方法。 而webviewer 绑定报表指定的是ReportName或Report属性。
如
GrapeCity.ActiveReports.PageReport rpt=new PageReport("路径");
Webviewer1.Report=rpt; 那么数据集如何添加 本帖最后由 Lenka.Guo 于 2016-11-29 11:57 编辑
Exep 发表于 2016-11-29 10:35
那么数据集如何添加
List数据源绑定参考博客: http://blog.gcpowertools.com.cn/ ... ListDataSource.aspx
Web写法如下:
PageReport rpt= new PageReport("....");
Report.Document.LocateDataSource += new GrapeCity.ActiveReports.LocateDataSourceEventHandler(document_LocateDataSource);
webViewer.Report=rpt
void document_LocateDataSource(object sender, GrapeCity.ActiveReports.LocateDataSourceEventArgs args)
{
if (args.DataSourceName == "ListDataSource" && args.DataSetName == "ListDataSet")
{
args.Data = GetData();
}
}
private List<Product> GetData()
{
List<Product> list = new List<Product>();
for (int i = 1; i <= 20; i++)
{
list.Add(new Product(){ID=i,Name="产品"+i.ToString(),Price =i * 10f,Stock=i * 20});
}
return list;
}
谢大神 可结贴 Exep 发表于 2016-11-29 13:43
谢大神 可结贴
:loap1:
页:
[1]