开发者

Conditionally control the visibility of a background image in a .NET report (rdlc)

开发者 https://www.devze.com 2023-03-26 12:04 出处:网络
Quick Summary: How can I condi开发者_JAVA技巧tionally control (at run-time) the visibility of a background image in a report using the built in .rdlc report capabilities in .NET (I am using VB).

Quick Summary: How can I condi开发者_JAVA技巧tionally control (at run-time) the visibility of a background image in a report using the built in .rdlc report capabilities in .NET (I am using VB).

The Story: I have a system that creates "certificates". The certificates are created based on a report definition (.rdlc) and displayed as PDF's to the user, they never see the report viewer control. This system has a public test site as well as the live production site. We want to place a water mark image on any of the certificates that are created by the test system. Basically because we don't want someone creating a test certificate and passing it off as a real one. There is a system level flag that is true when the site runs in test mode, I would like to trigger the visibility of the background image that is a watermark ONLY when that variable is TRUE. At this time I am able to pass a report parameter with this test mode variable, but can't find a way to trigger the visibility of the background image.

Please let me know if any more information is need or further clarification.

Thanks.


Well, I figured it out quicker than I expected. The trick in this case was to use an Expression for the BackgroundImage property's value (the source is set to Embedded). In my case it looked something like this:

=iif(Parameters!ShowTestWaterMark.Value, "WatermarkVoid1", nothing)

Where Parameters!ShowTestWaterMark.Value is the parameter of True or False, and the "WatermarkVoid1" was the name of the embedded image.

While this doesn't directly toggle the visibility of the image, it does meet my requirements to only have the image shown in a specific case.

0

精彩评论

暂无评论...
验证码 换一张
取 消