Unable to pass multiple values in querystring in .aspx to report at runtime

后端 未结 2 1594
面向向阳花
面向向阳花 2021-01-26 03:50

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

2条回答
  •  执念已碎
    2021-01-26 04:38

    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
        }
    }
    

提交回复
热议问题