How to Download File With ASP.NET on Buttton'S Onclick Event

How to download file with asp.net on buttton's onClick event?

I think you are looking for something like this.

private void Button1_click(object sender, System.EventArgs e)
{
Response.ContentType = "Application/pdf";
Response.AppendHeader("Content-Disposition", "attachment; filename=help.pdf");
Response.TransmitFile(Server.MapPath("~/doc/help.pdf"));
Response.End();
}

Button disabled but looks active

The :disabled selector can be used with CSS3

input[type="button"]:disabled
{
background:#dddddd;
}

Browser Compatibility:

 IE8+ FF1.5+ SA3.1+ OP9.2+ CH2+

For ASP.NET:

Add a CssClass attribute to your server-side button and refer it to the class containing the above CSS.



Related Topics



Leave a reply



Submit