传递LocalReport ReportViewer的参数 [英] Passing Parameter for LocalReport ReportViewer
问题描述
美好的一天。 我正在尝试在LocalReport模式下将参数传递给ReportViewer。 下面没有显示我在Text类型的.rdlc文件中创建了一个名为reasonCode的参数。 当我运行页面时,它会不断加载并闪烁
而且我从未看到数据。
如果我在.vb文件中注释掉以下2行报告运行正常。 这似乎以下2行是罪魁祸首,但我不知道为什么强>
&NBSP;的昏暗p_reasonCode作为ReportParameter =新ReportParameter(QUOT; reasonCode" ;, reasonCode)< /强>
<强>&NBSP; ReportViewer1.LocalReport.SetParameters(新泽西ReportParameter(){p_reasonCode})强>
/ Serge
以下是我的代码片段。 我错过了什么吗? 由于事先
通过改变的.vb代码以下&NBSP解决它。基本上只是加入&的如果不Page.IsPostBack()然后结束如果强>
<跨度风格= "字体大小:0.75em">&NBSP;如果不是Page.IsPostBack()那么
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; Dim reasonCode As String =" C"
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP;会话("reasonCode")= reasonCode
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; Dim p_reasonCode As ReportParameter = New ReportParameter(" reasonCode",reasonCode)
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; ReportViewer1.LocalReport.SetParameters(New ReportParameter(){p_reasonCode})
&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; ReportViewer1.LocalReport.Refresh()
结束如果
Good Day Folks. I'm trying to pass a parameter to the ReportViewer in LocalReport mode. Not shown below I've created a parameter named reasonCode in the .rdlc file of type Text. When I run the page it continuously loads and flickers and I never see the data.
If I comment out the following 2 lines in the .vb file the report runs fine. It seems the following 2 lines are the culprit but I don't know why.
Dim p_reasonCode As ReportParameter = New ReportParameter("reasonCode", reasonCode) ReportViewer1.LocalReport.SetParameters(New ReportParameter() {p_reasonCode})
/Serge
Below is a snippet of my code. Am I missing something ? Thanks in advance
Solved it by changing the .vb code to the following. Basically just added If Not Page.IsPostBack() Then End if
If Not Page.IsPostBack() Then
Dim reasonCode As String = "C"
Session("reasonCode") = reasonCode
Dim p_reasonCode As ReportParameter = New ReportParameter("reasonCode", reasonCode)
ReportViewer1.LocalReport.SetParameters(New ReportParameter() {p_reasonCode})
ReportViewer1.LocalReport.Refresh()
End If
这篇关于传递LocalReport ReportViewer的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!