如何从Code Behind传递rdlc报告参数值 [英] How to pass rdlc report Parameters value from Code Behind
本文介绍了如何从Code Behind传递rdlc报告参数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个.rdlc文件,其中有一些参数。我想从代码隐藏文件(.cs文件)中分配该参数值。
请帮助我
i have a .rdlc file where have some parameters. and i want to assign that parameters value from code behind file (.cs file).
Please help me
推荐答案
使用此类型的代码..你肯定会解决你的问题
Use this type of code .. Defiantly you will solve your Problem
ReportViewer1.LocalReport.EnableExternalImages = true;
string imagePath = new Uri(Server.MapPath(ds.Tables[0].Rows[0]["sImg"].ToString())).AbsoluteUri;
ReportParameter rp1 = new ReportParameter("img", imagePath);
string imagePath1 = new Uri(Server.MapPath(ds.Tables[0].Rows[0]["pimg"].ToString())).AbsoluteUri;
ReportParameter rp2 = new ReportParameter("priImg", imagePath1);
string imagePath3 = new Uri(Server.MapPath(ds.Tables[0].Rows[0]["sign"].ToString())).AbsoluteUri;
ReportParameter rp3 = new ReportParameter("presiImg", imagePath3);
string imagePath4 = new Uri(Server.MapPath(ds.Tables[0].Rows[0]["signsecretary"].ToString())).AbsoluteUri;
ReportParameter rp4 = new ReportParameter("secImg", imagePath4);
//ReportViewer1.LocalReport.SetParameters(parameter);
ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp1, rp2,rp3,rp4 });
注意:这里的ds是DataSet Class对象,它有图像物理路径。
谢谢
AARIF SHAIKH
Note: Here ds is DataSet Class object Which have the image physical path.
Thanks
AARIF SHAIKH
这篇关于如何从Code Behind传递rdlc报告参数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文