vs2010 rdlc报表

查询了很多地方,关于rdlc 的文章大都是vs2008或者vs2005 的,10上的很多东西都有所不同的了,找的很多属性都找不到。

其中以前的代码 不加

 if (!IsPostBack)
   {

 

            //绑定报表
            ReportViewer1.LocalReport.ReportPath = MapPath( "Report1.rdlc");
            //绑定数据源

    //注意dataset1必须和你报表所引用的table 一致

            ReportDataSource rds = new ReportDataSource("dataset1", ds.Table[0]);//注意这里的name和报表中的一致
            ReportViewer1.LocalReport.DataSources.Add(rds);
            ReportViewer1.LocalReport.Refresh();

 

}

就能解决,而2010 必须加上,否则将会不休止的循环从新调用load 的事件,不停的在 界面显示loading

 

 

 

2 微软报表 子报表 rdlc 绑定子报表数据源

 

想必拖一个子报表控件,然后指向一个报表文件就不用多说了,大家一定知道怎么弄。重要的是绑定子报表的数据源。当然不也为难

帖代码看吧

if (!IsPostBack)
   {

 

            //绑定报表
            ReportViewer1.LocalReport.ReportPath = MapPath( "Report1.rdlc");
            //绑定数据源

    //注意dataset1必须和你报表所引用的table 一致

            ReportDataSource rds = new ReportDataSource("dataset1", ds.Table[0]);//注意这里的name和报表中的一致

 

    this.ReportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(SubreportProcessingEventHandler);  
            ReportViewer1.LocalReport.DataSources.Add(rds);
            ReportViewer1.LocalReport.Refresh();

 

}

 

  void SubreportProcessingEventHandler(object sender, SubreportProcessingEventArgs e)
        {
           //注意dataset2必须和你子报表所引用的table 一致
           e.DataSources.Add(new ReportDataSource("DataSet2", ds2.Table[0]));

        }

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值