PictureObject not working as intended
YonasMGM opened this issue · comments
Hello,
My data source is a C# DataTable. It has Customer Name, Address and Photo. My .frx report template contains columns for Name and address as well as photo. The names and addresses for all customers display fine in the resulting pdf document with each customer in a row. BUT the picture object gets populated by the photo of the last customer in the list, i.e. all customer rows end up having the same photo. (This is when the last line in the C# code below is uncommented). With it commented out, no image is displayed.
What I am doing wrong?
The .frx file contains this line for the photo object:
PictureObject Name="PicBxPhoto" Width="75.6" Height="75.6" ImageLocation="[dtCustomersList.Photo]"
In the C# (ASP.NET) code I have this:
foreach (var item in customers)
{
dtRow = dtTable.NewRow();
dtRow["FullName"] = $"{item.Firstname} {item.Lastname}";
dtRow["Photo"] = @$"{webRootPath}{\{item.Id}_PhotoUrl}";
PictureObject picObject = new PictureObject();
picObject = report.FindObject("PicBxPhoto") as PictureObject;
if (picObject != null)
{
//picObject.ImageLocation = @$"{webRootPath}{\{item.Id}_PhotoUrl}";
}
}