RDLC subreport and rdlc report

Source: Internet
Author: User

RDLC subreport and rdlc report

1. Drag the RDLC design page into the table or rectangle.

2. Right-click a table or a rectangular cell, and insert a subreport.

3. Enter a name and use the report as a subreport.

Name: displayed on the design page for viewing purposes only

Use this report as a subreport: Enter the file name in the directory that needs to be the RDLC file of the subreport (XXX. RDLC), Only the file name does not need the. RDLC suffix name.

4. Right-click the subreport cell and select "subreport properties"> "Parameters" to add the parameter information to be passed to the subreport.

5. Open the report attribute on the subreport design page, right-click the parameter, add the parameter, and enter the parameter name entered in step 1.

6.

Viewer. localReport. subreportProcessing + = new SubreportProcessingEventHandler (LocalReport_SubreportProcessing); // Add void LocalReport_SubreportProcessing (object sender, Microsoft. reporting. webForms. subreportProcessingEventArgs e) {var errCode = 100; try {if (e. dataSourceNames [0] = "dsJcxh") // Replace the data set name in the quotation mark with the subreport {errCode = 3; e. dataSources. add (new ReportDataSource ("dsJcxh", GetSupervisionSamplingDetailData (e); // if there is only one subreport, ELSE is not required, more than three IF statements can be made.} 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) {// accept the parameter string productDictId = e in the rdlc of the subreport. parameters ["productDictId"]. values [0]; string spec = e. parameters ["spec"]. values [0]; string certificateNo = e. parameters ["certificateNo"]. values [0]; var list = new StatisticalLedgerBL (). partition (productDictId, spec, certificateNo); return list;} public List <StatisticalLedger1> GetUseRegisterData (SubreportProcessingEventArgs e) {// accept the parameter string productDictId = e in the rdlc of the subreport. parameters ["productDictId"]. values [0]; string spec = e. parameters ["spec"]. values [0]; var list = new StatisticalLedgerBL (). getUseRegisterData (productDictId, spec); return list ;}View Code

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.