Skip to main content

Show Download Image Popup On Button Click...



How to show the download Popup when we click on the button?

Add this code in Button Click Event

 Protected Sub btnExportToImage_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExportToImage.Click
{
 Response.ContentType = "png"
 Response.AppendHeader("Content-Disposition", "attachment; filename=TopIndustry.png")
 Response.TransmitFile(Server.MapPath("~/TempImageFiles/" + Session("ImageName").ToString()))
 Response.End()
}

- Image is stored on the server.
- so in this example image name is set on runtime and stored in to the session.
- On button click 

End Sub


It will show the Output:





Comments