Exep 发表于 2016-11-29 09:58:29

绑定list LoadDocument需要引用那个程序集

提示缺少引用

Lenka.Guo 发表于 2016-11-29 10:22:06

LoadDocument是Winform的方法。 而webviewer 绑定报表指定的是ReportName或Report属性。


GrapeCity.ActiveReports.PageReport rpt=new PageReport("路径");
Webviewer1.Report=rpt;

Exep 发表于 2016-11-29 10:35:07

那么数据集如何添加

Lenka.Guo 发表于 2016-11-29 11:55:37

本帖最后由 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:23

谢大神 可结贴

Lenka.Guo 发表于 2016-11-29 13:53:06

Exep 发表于 2016-11-29 13:43
谢大神 可结贴

:loap1:
页: [1]
查看完整版本: 绑定list LoadDocument需要引用那个程序集