How to include dynamic Images in Report??????
In report Designer, how can I use a DataField on a Picture element to format a source for the Image.
To me this is a basic operation and there is nothing documenting how to do it, at least I haven't found it, irritated!
Any help is appreciated!
-bert
0
-
Bert, here's how I did it. In my report I have a picture object "picHouse", and an invisible textbox object "txtbox". The datafield of txtbox is set to the field that contains the photo name.
Then, in the script tab, I have the following script:
public void detail_Format()
{Picture picHouse = rpt.Sections["detail"].Controls["picHouse"] as Picture;
TextBox txtbox = rpt.Sections["detail"].Controls["txtPhotoName"] as TextBox;
string txtPhoto = txtbox.Text+" ";
txtPhoto=txtPhoto.Trim();
if (txtPhoto == "")
{
txtPhoto="NoPicture";
}
if (txtPhoto == null)
{
txtPhoto="NoPicture";
}
string txtPath = "E:/Latitude Geographics/Geocortex Essentials/Default/REST Elements/Sites/OC_Resources/Images/HistoricPhotos/";
string txtExtension=".jpg";
string txtFinal= txtPath +txtPhoto+ txtExtension;
if (System.IO.File.Exists(txtFinal) != true)
{
txtFinal= txtPath +"NoPicture"+ txtExtension;
}
picHouse.Image = System.Drawing.Image.FromFile( txtFinal);
}Hope this helps.
Chris
0
Please sign in to leave a comment.
Comments
1 comment