protected void btnXlsExport_Click(object sender, EventArgs e)
{
//GridExporter.WriteXlsToResponse();
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);
ASPxGridView1.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
}