views:

190

answers:

2

Hi all,

I'm using reportviewer and I would like to add an unknown number of images to the report on runtime. The user should select some images (in another place) and those images should be displayed in the report one after the other. Do you have any idea how to do that using reportviewer?

thanks, Ofir

A: 

There are many ways to do this. Here is one possibility:

You will need to set up the datasource for the report dynamically, this blog post will help with that.

Your dataset needs to have a table with one column, of type string.

In the report designer (double click the rdlc file), add a table. Delete the columns until one is left. In the remaining cell, add an image. Set the image type to external. Set the image's src to an expression that is your dataset's field.

At runtime, collect all the images the user wants. These images need to be accessible to the reportviewer somewhere, on a local file system for the WinForms viewer, or on a server for the WebForms viewer. Then setup a string array containing the paths to these images as the report's datasource. The report will user these strings to find the images, and add one image for every string you give it.

Matt Greer
A: 

Thank you very much. It's finally working :)

Ofir