You must Sign In to post a response.
  • Category: ASP.NET

    How to View a Pdf by Clicking a Href link or LinkButton in Asp.Net

    hi Developers,

    i want to View a Pdf of any Attachment by Clicking a Href link or LinkButton in Asp.Net.
    and the Attachments should be open a blank page as well.
    the Attachments are Bind from the Database.

    i have trying with google if anyone have a better choice to this please suggest me to i am done this task.

    thanks with
  • #769336
    Hi Paul Raj.

    You can try something like first get path of that pdf file and send file path to javascript method like below.

    <img src="@Url.Content("~/images/view-pdf.png")" onclick="Show(@id);" style="cursor:pointer;" title="View Pdf"/>
    function show(id)
    var datatobesent=id;
    var ActionUri1 = "@Url.Action("ActionMethod", "Controller")";
    $.get(ActionUri1,datatobesent, function (result)
    ShowPdf(result);//result will have path of pdf file

    function ShowPdf(filePath)


    Sridhar Thota.
    Editor: DNS Forum.

  • Sign In to post your comments