• RDLC 子报表


    1.RDLC 设计页面,拖入table或者矩形

    2.右击表格或者矩形单元格,插入--子报表

    3.输入名称和将此报表用作子报表

       名称:显示在设计页面上的,仅作观看作用

      将此报表用作子报表:填写目录下的需要作为子报表的RDLC文件的文件名称(XXX.RDLC),只需要文件名称不需要.RDLC后缀名称。

    4.右击子报表单元格,子报表属性--参数,添加需要传给子报表的参数信息

    5.打开子报表设计页面的报表属性,右击参数,添加参数,输入第4步填写的参数名称

    6.

     viewer.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
    //主函数添加
     void LocalReport_SubreportProcessing(object sender, Microsoft.Reporting.WebForms.SubreportProcessingEventArgs e)
            {
                var errCode = 100;
                try
                {
                    if (e.DataSourceNames[0] == "dsJcxh")
                              //这里引号里替换成子报表的数据集名称
                    {
                        errCode = 3;
                        e.DataSources.Add(new ReportDataSource("dsJcxh", GetSupervisionSamplingDetailData(e)));
    //如果只有1个子报表ELSE后面就不需要了,3个以上 多次IF判断就可以了
                    }
                    else
                    {
                        errCode = 4;
                        e.DataSources.Add(new ReportDataSource("dsUr", GetUseRegisterData(e)));
                    }
                }
                catch (Exception ex)
                {
                    Response.Write(ex.Message + ":" + errCode);
                }
            }
       public List<StatisticalLedger> GetSupervisionSamplingDetailData(SubreportProcessingEventArgs e) {
               //接受子报表RDLC里面的参数
                string productDictId =e.Parameters["productDictId"].Values[0];
                string spec = e.Parameters["spec"].Values[0];
                string certificateNo = e.Parameters["certificateNo"].Values[0];    
                       var list = new StatisticalLedgerBL().GetSupervisionSamplingDetailData(productDictId, spec, certificateNo);
                return list;
            }
            public List<StatisticalLedger1> GetUseRegisterData(SubreportProcessingEventArgs e)
            {
               //接受子报表RDLC里面的参数
                string productDictId = e.Parameters["productDictId"].Values[0];
                string spec = e.Parameters["spec"].Values[0];
                var list = new StatisticalLedgerBL().GetUseRegisterData(productDictId, spec);
                return list;
            }
           
    View Code
  • 相关阅读:
    将一张图片的人物融入另一张图片中
    填充---内容识别图片
    使用蒙版--渐变--制作瓶子倒影
    form表单基础知识
    表格排版及其表格嵌套
    HTML表格,table,thead,tbody,tfoot,th,tr,td,的属性以及跨行,跨列
    垃圾收集,内存问题
    JS预解析机制
    python ==》 内置函数
    python ==》 递归
  • 原文地址:https://www.cnblogs.com/zhuzy/p/5566075.html
Copyright © 2020-2023  润新知