ReportViewer doesnt work if a parameter contains an ampersand

  • I have a vb.net application that uses the reportviewer component to display reports.

    I have noticed that if an amperand(&amp is part of an input parameter for a report then I get an rsInvalidItemPath error.

    The reportviewer builds a url which seperates all the parameters with an ampersand - hence the problem(I guess).

    I cannot find any help from Microsoft regarding this issue.

    Has anyone else come across it?  If so do you have an answer?

     

    Thanks in advance

    Niall

     

  • What about reviewing the data after the submit has been issued and before the data is passed to convert the & to a different character and then convert it back or just scrub the parameter to remove the & ??



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • I was hoping to be able to avoid mucking around like that - but maybe that is what I have to do.

    Thanks for your reply.

     

    Niall

     

  • As Reporting services is a web-service based application, you are likely going to need to be careful about restricted characters. I haven't ran into the problem (yet!) myself, but you're probably going to have to encode "&" ... assuming this is possible in some layer of your app!

  • I dont have a problem with encoding a string in my app.  The problem is in decoding it in either reporting services before the the stored procedure is called or in the stored procedure.  I dont think it is possible to decode in either (at least easily).

  • According to the link below, 'You do not have to encode any of the characters manually'

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rsprog/htm/rsp_prog_urlaccess_7kbq.asp

    Unfortunately, this is not the case for ampersands (&amp. For example, if you wish to pass the Sub-Department Brushes & Brooms you need to encode the ampersand as it will cut off the parameter at the ampersand character. To do this use the Replace function as shown below, in the navigation expression window of the report which contains the link. Please note you do not have to do any extra work in unencoding the URL (and the %26), because fortunately, Reporting Services does it for you.

    Replace(Fields!SubDepartment.Value ,"&","%26")

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply