tomouse
Technical User
- Aug 30, 2010
- 50
I am sending data from my ASP.NET website to a local Reporting Services report (rdlc), which is sitting in a ReportViewer control. It is mostly running fine, with one exception. I am not able to display the parameters that the user is sending to the report. Here is the code on the aspx file:
And here is the codebehind:
On the actual report I have added a textbox and given it the expression: =Parameters!idPurchase.Value. However, even though this should display as 171, it is actually showing as 0.
In the block above I have put **stars** round the section where I add the report parameters. Seems that although the SelectParameters (above) for the datasources are going across fine (I know this because the correct data is showing in the report), the Report parameters aren't. Can anyone see what I'm doing wrong?
Code:
<asp:Panel runat="server" ID="pnlReport" Width="90%" Height="850px" >
<asp:ObjectDataSource ID="ods1" runat="server" SelectMethod="PurchaseConsultarPorIDPurchase" TypeName="DEApp.dtsDEAppTableAdapters.tbaConsultarPurchases" >
<SelectParameters><asp:Parameter Name="idPurchase" Type="Int32" /></SelectParameters>
</asp:ObjectDataSource>
<rsweb:ReportViewer ID="rptv1" runat="server" Font-Names="Verdana" Font-Size="8pt" Height="650px" Width="80%" >
<LocalReport ReportPath="rptPurchase.rdlc">
<DataSources>
<rsweb:ReportDataSource DataSourceId="ods1" Name="dtsDEApp_dttPurchaseConsultarView" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
</asp:Panel>
Code:
Dim rpt As New LocalReport
rpt.ReportPath = "rptPurchase.rdlc"
ods1.SelectMethod = "PurchaseConsultarPorIDPurchase"
ods1.SelectParameters("idPurchase").DefaultValue = id
'*****
Dim prmIdPurchase As New Microsoft.Reporting.WebForms.ReportParameter("idPurchase", id)
Dim prmLang As New Microsoft.Reporting.WebForms.ReportParameter("iLang", iLangArg)
Dim pcol As New List(Of ReportParameter)
pcol.Add(prmIdPurchase)
pcol.Add(prmLang)
rpt.SetParameters(pcol)
'*****
rptv1.LocalReport.Refresh()
In the block above I have put **stars** round the section where I add the report parameters. Seems that although the SelectParameters (above) for the datasources are going across fine (I know this because the correct data is showing in the report), the Report parameters aren't. Can anyone see what I'm doing wrong?