Export Grid view to excel and save excel file to folder
<p>I want to save excel file which export data of grid view.I have written code to export gridview data to excel but i dont know, how to save exported file.</p>

<p>Following is my code to export gridview into excel :</p>

<pre><code> Response.Clear();
    Response.Buffer = true;
    Response.ContentType = "application/vnd.ms-excel";
    Response.AddHeader("content-disposition", "attachment;filename=MyFiles.xls");
    Response.Charset = "";
    this.EnableViewState = false;
    System.IO.StringWriter sw = new System.IO.StringWriter();
    System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);
    gvFiles.RenderControl(htw);
    Response.Write(sw.ToString());
    Response.End();
</code></pre>

<p>Please help 
and thanks in advance.</p>
