将值传递给ReportViewer中的文本框 [英] pass value to textbox in ReportViewer
本文介绍了将值传递给ReportViewer中的文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
a bill项目,有一个带有列表框的表格,用项目填写,每个项目都有价格,按钮可以计算金额,折扣和总额。
然后有一个报告视图,它以同样的形式提交(我已经用parametar完成了)
在报表设计中,我添加一个页脚,3个textBox's。
i想要将总和,折扣和总价值传递给报告中的文本框吗?
任何想法!
Hi,
a bill project, have a form with listbox to fill it with items and every item have a price, button to caluctate the sum, Discount and Total.
then there is a reportview in the same form it filers(i've done it with parametar)
in report design, ive add a page footer, 3 textBox's.
i want to pass the sum, Discount and total value to the textbox's in the report?
any idea!.
www.mediafire.com/view/vth084te37hv7
推荐答案
1.首先在报告中添加3个参数(转到报告>>添加参数,名称为'sum','discount'和'total'。
2.在报告中右键单击文本框并转到表达式>>点击参数(类别中)
>>双击要在文本框中显示的参数。
它表达式为
1.At first add 3 parameters on report (go to report >>add parameters give name as 'sum','discount' and 'total'.
2.On report right click on text box and go to expression >> click on parameters (in category)
>> double click on parameters which you want to display in your textbox .
it gives expression as
'=Parameters!sum.Value'
3.在加载报告前应用以下代码
3. apply code below before loading report
ReportParameter[] allPar = new ReportParameter[3]; // create parameters array
ReportParameter parSum = new ReportParameter("sum", "195");
ReportParameter parDiscount = new ReportParameter("discount", "19");
ReportParameter parTotal = new ReportParameter("total", "176");
allPar[0] = parSum; //assign parameters to parameter array
allPar[1] = parDiscount;
allPar[2] = parTotal;
reportViewer1.LocalReport.SetParameters(allPar); // set parameter array
this.reportViewer1.RefreshReport();
这篇关于将值传递给ReportViewer中的文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文