Try This,
public void ExportToExcel()
{
this.EnableViewState = false;
Response.Charset = string.Empty;
BindDataGrid(false);
Response.AddHeader("content-disposition", "attachment;filename=CategoryList_" + System.DateTime.Now.ToShortDateString() + ".xls");
Response.ContentType = "application/ms-excel";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
System.Web.UI.HtmlControls.HtmlForm htmlform = new System.Web.UI.HtmlControls.HtmlForm();
htmlform.Attributes["runat"] = "Server";
dgvCategory.Parent.Controls.Add(htmlform);
htmlform.Controls.Add(dgvCategory);
htmlform.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}