• How to add image in ReportViewer control in ASP.NET

    by  • May 7, 2014 • Microsoft .NET C# (C-Sharp), Microsoft ASP.NET • 0 Comments

    I have explained in detail about ReportViewer and how to create report using ReportViewer in my previous article. In this article, I will show you how you can add images to your report. No matter how we create our reports but we definitely need images on it to be more attractive or we have to add images for user needs. There are more than one ways to add image in ReportViewer control and that image will be on your report. You can simply add an embedded image to your application or you can add an external image or the image may be in database and you can add it from database.

    How to add an embedded image in ReportViewer control

    • Right click on the Images in report menu in rdlc file.
    • Click Add Image, browse and select your image and add it.

    Add Image

    • Now click Insert > Image>select embedded and select the added image.

    Embedded Image

    How to add external image in ReportViewer control

    • You can add external images in two ways. First you can simple add it in rdlc file.
    • Click Insert > Image > select External and add file path. “File://” is the key for connection to the local drive.

    External Image

    • Second, you can add external image using code
    • You need to add a parameter by right clicking on Parameters in report menu in rdlc file.

    Add Parameter

    • Change parameter name according to your need.

    Parameter Name

    • Click Insert > Image > select External and add parameter value. “file:///” is the key for connection to the local drive.

    External Image Parameter

    • Now write following lines of code in your code file where you are generating your report




    Namecheap.com
    Avatar of GetCodeSnippet.com

    About

    GetCodeSnippet.com provides you high quality Microsoft .NET development related articles, tutorials and sample code for ASP.NET, C#, VB.NET, AJAX, WCF, WPF, Web Services, Windows Services, SQL Server and other technologies.

    Leave a Reply