Hi,
I am trying to create a report using ReportViewer (.rdlc). The report consists of data from SharePoint list and picture library. I created an application page under Layouts folder. In the the application page has only ReportViewer control.
In the ReportViewer file (.rdlc), I created a textbox control and an image control. For my testing purpose, the textbox will bind the site name (SPSite.RootWeb.Title), and the Image control will bind a picture from the picture library in the same site.
I managed to bind the site title to the textbox control by setting ReportViewer parameter in the code-behind. For the image control, I set the parameter for the Image with the URL of the image in the picture library. Unfortunately, the image does not show. I tested with a random image from Google. The image appears as I expected. If I pass the URL from SharePoint, it does not show the image.
ReportViewer1.LocalReport.EnableExternalImages = true;
string siteName = GetSiteName();
ReportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("SiteName", siteName));
string signatureImage = GetSignatureImageURL();
ReportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter("SignatureImage", signatureImage));
ReportViewer1.LocalReport.Refresh();GetSiteName() returns the site.title.
GetImageURL returns "http://<webapplicationurl>/sites/siteCollection/PictureLibrary/image.jpg".
** Only the first return works (http://img.enkivillage.com/s/upload/images/2016/06/a13164bc04a62c57daaab75e1f0efd72.jpg). The image from https url does not work either.
private string GetSignatureImageURL()
{
using (SPSite oSite = SPContext.Current.Site)
{
using (SPWeb oWeb = oSite.RootWeb)
{
SPPictureLibrary oList = (SPPictureLibrary) oWeb.Lists["SignaturePic"];
SPItem lookupItem = oList.GetItemById(10);
//return "http://img.enkivillage.com/s/upload/images/2016/06/a13164bc04a62c57daaab75e1f0efd72.jpg";
//return "https://upload.wikimedia.org/wikipedia/commons/thumb/5/56/Autograph_of_Benjamin_Franklin.svg/2000px-Autograph_of_Benjamin_Franklin.svg.png";
return "http://<server>/sites/playground/SignaturePic/Signature.jpg";
//return "http://<server>" + lookupItem["ServerUrl"].ToString();
//return oSite.WebApplication.AlternateUrls[0].Uri.AbsoluteUri + lookupItem["ServerUrl"].ToString();
}
}
}Please help me with this issue.
Thank you,