Passing Single value and Multi value parametes to SSRS report server from asp.net

Posted by Ylsv under Sql Server on 9/16/2013 | Points: 10 | Views : 1706 | Status : [Member] | Replies : 1
I have been struggling with this for the past 4 days. I tried all possible solutions from different forums. I do have two parameters in the reports. The first one can accept a single value and second parameter accepts multiple values. I have set the 2nd parameter as multi value parameter and its expression as Join(Parameters!Route.Value,","). For some reason I get the error message “Parameter “Route” is missing its value”. Here is my code


If Not ((ddlLocation.SelectedValue = "") Or (chkMultipleRoutes.SelectedValue = "")) Then
'Dim SelectedRoutes As New List(Of String)
Dim myAL = New ArrayList
Dim Routes As New List(Of String)
myAL.Add(ddlLocation.SelectedValue)
For i As Integer = 0 To chkMultipleRoutes.Items.Count - 1
If chkMultipleRoutes.Items(i).Selected Then

'txtSelectedRoutes.Text += chkMultipleRoutes.Items(i).Text + "','"
myAL.Add(chkMultipleRoutes.Items(i).Text)

txtSelectedRoutes.Text += chkMultipleRoutes.Items(i).Text + ","
txtSelectedRoutes_PopupControlExtender.Cancel()

End If
Next



Dim reportParameterCollection As ReportParameter() = New ReportParameter(1) {}
reportParameterCollection(0) = New ReportParameter()
reportParameterCollection(0).Name = "LocationID"
reportParameterCollection(0).Values.Add(ddlLocation.SelectedValue)

reportParameterCollection(1) = New ReportParameter("Route", CType(myAL.ToArray(GetType(String)), String()))



ReportViewer1.Visible = "True"
ReportViewer1.ProcessingMode = ProcessingMode.Remote
ReportViewer1.ServerReport.ReportServerUrl = New Uri("http://test/ReportServer_RPT")
ReportViewer1.ServerReport.ReportPath = "/ReportTest"

ReportViewer1.ServerReport.SetParameters(reportParameterCollection)
ReportViewer1.ServerReport.Refresh()


I really appreciate any help this. What is that I am doing wrong here?

Thanks
ylsv




Responses

Posted by: Bandi on: 9/18/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Refer this link
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/e04c01b9-9bb7-4900-bb51-ae4b2af1e89e/passing-a-multi-value-parameter-from-aspnet-application-to-ssrs-report

Refer this link... This might help you for sure
http://stackoverflow.com/questions/7377016/ssrs-set-parameters-programmatically-causing-to-state-validvaluemissing?rq=1

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Ylsv, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response