Multiple Placeholders / Images

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF ReportWriter for .NET (v4)  /  Multiple Placeholders / Images

DynamicPDF ReportWriter for .NET (v4) Forum

 May 05 2008 5:18 PM
I have some reports that require multiple images to be loaded. The image paths are stored in the database. Once I add the placeholders for the images, I must assign the correct image to the appropriate placeholder. I can retrieve the placeholder element from the document layout using GetElementById() method and then add an event handler for the LaidOut event. However, I don't won't to have to create a different handler for every image I need to load. The event handler's arguments do not seem to provide the element id of the placeholder, so I'm not sure which placeholder is currently being laid out, and thus can't place the corrent image in the placeholder. Has anyone found an easier way to accomplish this?

Thanks,
Matt
 May 06 2008 7:46 AM
Posted by a ceTe Software moderator
Hello Matt,

If you want to add multiple images by using the PlaceHolders then you will have to add different LaidOut events for each placeholder. If you have a combined single image then you can have only one placeholder and an event.

If you are getting the path of the image from the database then it will get the path associated with the current record and you can load the image using this path without any problem. You do not need to keep track of the record number or the placeholder id.

This event will have the sender object as a parameter but not the Id of the element.

Thanks,
ceTe Software Support Team.

 May 06 2008 8:02 AM
Can you please elaborate on this:

"If you are getting the path of the image from the database then it will get the path associated with the current record and you can load the image using this path without any problem."

How (and when) do you get the image path in code-behind? Is there an event that loops through the records being pulled? I have set the connection string and other dynamic fields using the report writer GUI.

Creating a new event handler for every image that I need to dynamically load does seem feasible in the scope of my project, as I could have several images for any given template (and I have between 30-50 templates to create). I'll try to come up with a creative solution, but any prior experience will be greatly appreciated.
 May 06 2008 8:53 AM
Posted by a ceTe Software moderator
Hello Matt,

Yes, you can get the path stored in your table using its field name for the current record. You can get this in the LaidOut event. You do not have to write any loop to go through the records. This event will be fired for each record. Following is the sample code to get the path.

string path = e.LayoutWriter.RecordSets.Current["ImagePath"].ToString();

You can use this path to create the Image object. You can refer to the Handling Events topic on our help documentation.

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 8:27 AM.