This should be simple process but now it became annoying issue.
I am trying to pass multiple value in query string in my ASP.Net web report in VS2012. The page has to p
strPb1.Length will always be greater than 0 in your code. If there are no commas Split(',') will still return an array containing the original string. Therefore, your initial setting of value isn't necessary.
The QueryString and split() itself seem to be fine. Perhaps the problem lies elsewhere in your code or the querystring you're using. If you're going to add the commas back into your string, why remove them?
Also, An alternative to using a comma delimited parameter is reusing the same parameter. www.test.com/?pm1=test1&pm1=test2&pm1=test3
string[] strPb1 = Request.QueryString.GetValues("pm1");
if(strPb1 != null && strPb1.Length > 0)
{
for(int i = 0; i != strPb1.Length; i++)
{
//Code here
}
}
Thank you for your time and valuable inputs. I tried different approach but was not accepting the values that we are passing from the code.
Since the report is not accepting the multi-value Parameter values via code, I added another parameter in report which is set to null by default. Via code, I am passing the values to this parameter. if the value is present then we are ignoring the values from the multi dropdown parameter "pb1". With this approach we are able to pass multiple values via query string for Pb1 and/or Pb2 but the only downside is that now we have a new parameter in report.
I am not in favor of this new dummy parameter approach but in past 2-3 days I tried my best to pass multiple values to the parameter in the dropdown list via code but somehow did not work. It should be a simple process. This is very baffling but I will get to the bottom of this. Meanwhile I can use current approach.
Again thanks much for all your efforts :)