Link to home
Create AccountLog in
Avatar of btrieve
btrieve

asked on

Adding Data Bound Image to Header Reporting Services SSRS

I am attempting to add a data-bound image to report headers in Reporting Services.

I understand that I need to place a textbox in the body of the report and then, using some conversion expressions, bring the image up into the header. I have done this using the instructions below, but I continue to get #Error in the header. I know the =Convert.ToBase64String(Fields!Photo.Value) function is working, but apparently the second conversion is failing.

Any advice on this?

Instructions for Adding a Data-Bound Image to a Header or Footer:

You can use image data stored in a database in a header or footer. However, you cannot reference database fields from the Image report item directly. Instead, you must add a text box in the body of the report and then set the text box to the data field that contains the image (note that the value must be base64 encoded). You can hide the text box in the body of the report to avoid showing the base64-encoded image. Then, you can reference the value of the hidden text box from the Image report item in the page header or footer.

For example, suppose you have a report that consists of product information pages. In the header of each page, you want to display a photograph of the product. To print a stored image in the report header, define a hidden text box named TXT_Photo in the body of the report that retrieves the image from the database and use an expression to give it a value:

=Convert.ToBase64String(Fields!Photo.Value)

In the header, add an Image report item which uses the TXT_Photo text box, decoded to show the image:

=Convert.FromBase64String(ReportItems!TXT_Photo.Value)

Avatar of EugeneZ
EugeneZ
Flag of United States of America image

check this one:
Reporting Services - Add a logo to the Report Manager
http://weblogs.asp.net/jgalloway/archive/2006/12/12/reporting-services-add-a-logo-to-the-report-manager.aspx
Avatar of btrieve
btrieve

ASKER

Hi,

Thanks for the reply but what I'm trying to do is add a data-bound image (from db) to the header of a report.

Does anyone out there have any experience with that?
check:
How to: Add a Data-Bound Image (Reporting Services)
http://msdn.microsoft.com/en-us/library/ms156342.aspx 
I see you found the answer:
Adding a Data-Bound Image to a Header or Footer
You can use image data stored in a database in a header or footer. However, you cannot reference database fields from the Image report item directly. Instead, you must add a text box in the body of the report and then set the text box to the data field that contains the image (note that the value must be base64 encoded). You can hide the text box in the body of the report to avoid showing the base64-encoded image. Then, you can reference the value of the hidden text box from the Image report item in the page header or footer.
For example, suppose you have a report that consists of product information pages. In the header of each page, you want to display a photograph of the product. To print a stored image in the report header, define a hidden text box named TXT_Photo in the body of the report that retrieves the image from the database and use an expression to give it a value:
=Convert.ToBase64String(Fields!Photo.Value)
In the header, add an Image report item which uses the TXT_Photo text box, decoded to show the image:
=Convert.FromBase64String(ReportItems!TXT_Photo.Value
Avatar of btrieve

ASKER

Hi,

Thanks so much for your reply.

I have attempted this but something about the =Convert.FromBase64String(ReportItems!TXT_Photo.Value) function is failing.

The text box in the body of the report with =Convert.ToBase64String(Fields!Photo.Value)  is working, but the text box in the header with =Convert.FromBase64String(ReportItems!TXT_Photo.Value) continues to yield #Error.

I am a beginner in this subject matter, so I may very well be overlooking something. I have read and reread the reference you have cited but something is off.

Any suggestions?

Thank You,

Ryan
Avatar of btrieve

ASKER

I've gotten this to work but now my data-bound image will not repeat on any page other than the page containing the textbox (Page 1).

I've tried extensively but can't seem to get the textbox to repeat on each page, enabling the image to be shown.

Please help.

Thanks,

Ryan
ASKER CERTIFIED SOLUTION
Avatar of Computer101
Computer101
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer