hi i am working on web application, and i need to export some data from grid view to Excel . which i am able to do propely with Http Responce but need some help not to give any user selection while saving excel but with a static File path. is there a way to do so? here is my as follows
Response.ClearContent();
Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", FileName + ".xls"));
Response.Charset = "";
Response.ContentType = "application/excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
gvPreview.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
which will ask for user input to select a location to save the Exported .xls file.
sateesh kumar singupuram