How to add Parameterized Image in RDLC report? [Resolved]

Posted by Amatya under C# on 10/21/2016 | Points: 10 | Views : 214 | Status : [Member] | Replies : 2
How to add Parameterized Image in RDLC report? i.e. Dynamically report

Thanks in Advance

Feel free to share informations 9731764134
Thanks



Responses

Posted by: Rajnilari2015 on: 10/22/2016 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 50

Up
0
Down

Resolved
@Amatya Sir,
Please follow this steps -

RDLC Report Configuration
-----------------------------

a) Add a blank RDLC Report and an Images folder to the Solution file.
b) Now add a Parameter to the RDLC Report of type text and provide a name say MyDynamicImagePath
c) Insert an Image on to the RDLC Report from Insert->Image . Select the Image Source as External
d) Go to image properties. There you will find various kind of options like General,Size,visibility,Action, Border.
- Choose the "General" tab and in the "Use this image" property write the formula
=Parameters!MyDynamicImagePath.Value

- Choose the "Size" tab and set the "Display" property as Original Size.

C# code
-------

N.B. ~ You must already have a ReportViewer Control in your design

protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report.rdlc");
ReportViewer1.LocalReport.EnableExternalImages = true;
string imagePath = new Uri(Server.MapPath("~/images/TestImage.png")).AbsoluteUri;
ReportParameter parameter = new ReportParameter("MyDynamicImagePath", imagePath);
ReportViewer1.LocalReport.SetParameters(parameter);
ReportViewer1.LocalReport.Refresh();
}
}

Hope that helps

--
Thanks & Regards,
RNA Team

Amatya, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Amatya on: 10/27/2016 [Member] Starter | Points: 25

Up
0
Down
Thanks its working. I have done before some month what you have mentioned but I missed.
Thanks again for refreshing

Feel free to share informations 9731764134
Thanks

Amatya, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response