Posted on: 4/21/2011 1:02:02 PM | Views : 317

Hello, I have a grid in which file names are displayed as link buttons. But when I click on link button, file does not open. Please see the cs file code method to open file.
 
protected void OpenFile(object sender, EventArgs e) { LinkButton btn = (LinkButton)sender; string fileName = btn.Attributes["FileName"].ToString(); string path = Server.MapPath(".") + "\\Files\\" + fileName; if (File.Exists(path)) { Response.AppendHeader("content-disposition", "attachment; filename=" + fileName); string type = "Application/word"; if (type != "") Response.ContentType = type; Response.WriteFile(path); Response.End(); } else { } //System.Diagnostics.Process.Start(@path); //Response.Write(path); ...

Go to the complete details ...