<ext:button id= "Button1" runat= "Server" text= "button" onclick= "Button1_Click" enableajax= "false" >//<span Style= "Font-family:arial, Helvetica, Sans-serif;" >enableajax= "False" is the most important </span> </ext:Button>
protected void Button1_Click (object sender, EventArgs e) { try { string filepath = "E:\\123.xls"; string filename = System.IO.Path.GetFileName (filepath); Response.Clear (); Response.ClearHeaders (); Response.Buffer = false; Response.ContentType = "Application/octet-stream"; Response.contentencoding=system.text.encoding.getencoding ("Utf-8"); Response.AddHeader ("Content-disposition", "attachment; Filename= "+ System.Web.HttpUtility.UrlEncode (filename, Encoding.UTF8)); Response.WriteFile (filepath); Response.Flush (); Response.End (); } catch (Exception E) { //alert ("The data you want to download is not found!"); } }
Document download by document path under Extaspnet