Passing a Multi-value parameter to the ReportViewer control using VB

Private Sub SetReportParameters()
‘Set Processing Mode
ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote
ReportViewer1.AsyncRendering = False
‘ Set report server and report path
ReportViewer1.ServerReport.ReportServerUrl = New Uri(Session(“ReportServerUrl”).ToString())
ReportViewer1.ServerReport.ReportPath = Session(“ReportPath”).ToString() + Session(“SSRSReportName”).ToString()

‘ReportParameterInfoCollection(parameters = ReportViewerViewReport.ServerReport.GetParameters())

Dim paramList As New Generic.List(Of ReportParameter)
Dim pInfo As ReportParameterInfoCollection
pInfo = ReportViewer1.ServerReport.GetParameters()
If Not pInfo(“AccountID”) Is Nothing Then
paramList.Add(New ReportParameter(“AccountID”, Session(“AccountID”).ToString(), True))
End If

If Not pInfo(“LST_TXT_IRPARTNERS”) Is Nothing Then
Dim param As ReportParameter = New ReportParameter(“LST_TXT_IRPARTNERS”)
Dim p1 As String = Session(“SelectedIRPartners”).ToString()
Dim p2() As String = p1.Split(“,”)
param.Values.AddRange(p2)
paramList.Add(param)
‘paramList.Add(New ReportParameter(“LST_TXT_IRPARTNERS”, Session(“SelectedIRPartners”).ToString(), True))
End If

ReportViewer1.ServerReport.SetParameters(paramList)

‘ Process and render the report
ReportViewer1.ServerReport.Refresh()

Advertisements
By simplemsexchange Posted in VB.NET

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s