Reportviewer - dynamic images in header & fileExists

Unanswered Reportviewer - dynamic images in header & fileExists

  • 03 April 2012 22:35
     
     

    Using ReportViewer for Windows forms in VS2010.

    I have a report that has a user defined image in the header and footer.   This image's path is retrieved from database field.    It's possible that the user stored nothing at all as the path or moved/deleted the image before generating the report.

    With a little tinkering, this is working great.   Now I want to change the visibility of the image based upon if the image truly exists or not so I do not display a red x.

    In the image properties, I tried to add an expression with custom code to the visibility tab.  The custom code calls a function that uses my.computer.filesystem.fileExists().    It's throwing an error that the assembly does not allow partially trusted callers, I assume meaning I can not call the fileExists function from the custom code area due to security.

    Is there a solution to this or a different strategy I can use to set my image visibility?

Semua Balasan

  • 04 April 2012 21:02
     
     
    OK - so I found that system.io.file.exists() works a little better - at least it doesn't throw the error - however, it always evaluates to false.   Not sure if there is a workaround or not.   In reading documentation on my.computer.filesystem.fileExists() I found that it will always evaluate false if permissions are not good...   I suspect the same is true for system.io.file.exists.
    • Diedit oleh 86atc250r 04 April 2012 21:02
    •