小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

vs2010 rdlc報(bào)表

 牛人的尾巴 2016-03-31

查詢了很多地方,關(guān)于rdlc 的文章大都是vs2008或者vs2005 的,10上的很多東西都有所不同的了,找的很多屬性都找不到。

其中以前的代碼 不加

 if (!IsPostBack)
   {

 

            //綁定報(bào)表
            ReportViewer1.LocalReport.ReportPath = MapPath( "Report1.rdlc");
            //綁定數(shù)據(jù)源

    //注意dataset1必須和你報(bào)表所引用的table 一致

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

 

}

就能解決,而2010 必須加上,否則將會(huì)不休止的循環(huán)從新調(diào)用load 的事件,不停的在 界面顯示loading

 

 

 

2 微軟報(bào)表 子報(bào)表 rdlc 綁定子報(bào)表數(shù)據(jù)源

 

想必拖一個(gè)子報(bào)表控件,然后指向一個(gè)報(bào)表文件就不用多說(shuō)了,大家一定知道怎么弄。重要的是綁定子報(bào)表的數(shù)據(jù)源。當(dāng)然不也為難

帖代碼看吧

if (!IsPostBack)
   {

 

            //綁定報(bào)表
            ReportViewer1.LocalReport.ReportPath = MapPath( "Report1.rdlc");
            //綁定數(shù)據(jù)源

    //注意dataset1必須和你報(bào)表所引用的table 一致

            ReportDataSource rds = new ReportDataSource("dataset1", ds.Table[0]);//注意這里的name和報(bào)表中的一致

 

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

 

}

 

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

        }

 

 3.分頁(yè)報(bào)表   按照字段分類,比如,按人,每個(gè)人的 數(shù)據(jù)在一頁(yè)上。

  首先在工具欄 拖一個(gè) list 控件,設(shè)置 list 的屬性,按照某個(gè)字段分組,然后再向list中拖一個(gè)table  按照普通的寫(xiě)法綁定數(shù)據(jù)即可。

 

 4.綁定參數(shù) 賦值,底層代碼

                ReportParameter rp = new ReportParameter("ReportTitle", “參數(shù)賦值”);  ---ReportTitle為參數(shù)名稱
                ReportViewer1.LocalReport.SetParameters(rp);

 5 Image控件使用

   添加固定圖片(嵌入式圖片)
   選擇一個(gè)RDLC報(bào)表文件,選擇菜單欄中的報(bào)表-->嵌入圖像-->新建圖像(從本地選擇一個(gè)圖片)-->確定選中
   從工具欄拖動(dòng)一個(gè)Image控件(圖像)到RDLC,設(shè)置Source屬性為Embedded,Value屬性為剛才添加的圖    片名稱即可
   動(dòng)態(tài)加載圖片(根據(jù)圖片路徑) 
   菜單-->報(bào)表-->報(bào)表參數(shù)(新增一個(gè)參數(shù),比如名稱為image1,類型為string)拖動(dòng)一個(gè)image控件到rdlc報(bào)表中,設(shè)置Source屬性為External,Value屬性為=Parameters!image1.Value   (注意:這里的image1要和報(bào)表參數(shù)的名稱一致)包含報(bào)表文件的asp.net窗體
   this.ReportViewer1.LocalReport.EnableExternalImages = true;
   string path = "file:///" + Server.MapPath("~") + "Images\\image.gif";   //圖片地址
   ReportParameter image = new ReportParameter("image1", path);   //image1必須和報(bào)表參數(shù)一致
    this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { image });

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多