Bind picture from computer
Hi. I'm developing a registration form, in which it will display a person's data and will have a band that will loop through the database to list some additional data.
In this band, there will be a photo, but this photo is not stored in the database but on the server.
How can I pass a list of images to be related to each record of a band?
Thanks.
This discussion has been closed.
Comments
Here is my report layout.
The loop is in "DEPENDENTES DO SÓCIO" and I need to set a picture for each row, but this picture is not in database.
Is there any way to assign this picture from C# code?
Hello!
To display a separate photo from a disk or server for each DataBand record, based on the path from the database (or the record ID):
Place a PictureObject component on the DataBand and configure a BeforePrint event handler for it (or bind ImageLocation to a column expression if the column contains the full file path):
private void Picture1_BeforePrint(object sender, EventArgs e) { var pic = (PictureObject)sender; string filePath = Convert.ToString(Report.GetColumnValue(‘Photos.FilePath’)); // or Path.Combine(@‘C:\ServerPhotos’, Report.GetColumnValue(‘Photos.Id’) + ‘.jpg’); if (!string.IsNullOrEmpty(filePath) && System.IO.File.Exists(filePath)) pic.ImageLocation = filePath; else pic.ImageLocation = ‘’; }You can also populate the byte[] column at the DataTable/List<T> level before calling RegisterData(...) and specify it in PictureObject.DataColumn.