title: warning message while opening the excel file after export from gridview
body: <p>i have written code to export data but warning message i am facing while opening the excel file and by default file is saving as .html extension</p>
  
  <p>warning - "The file you are opening in a different format than specified by the file extension"</p>
  
  <p>i need with .xls extension to be saved 
  please help me</p>
  
  <pre><code>  private void ExportToExcel(DataTable dt)
    {
   string fileName = "FileName" + DateTime.Now.ToString("MMddyyyy_HHmmss") + ".xls";
  
          Response.AddHeader("content-disposition", "attachment;filename=" + fileName);
  
          //Response.AddHeader("content-disposition", "attachment;filename=Filename .xls");
          Response.ContentType = "application/vnd.ms-excel";
  
          StringWriter stringWriter = new StringWriter();
          HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWriter);
          DataGrid dataExportExcel = new DataGrid();
          dataExportExcel.ItemDataBound += new DataGridItemEventHandler(dataExportExcel_ItemDataBound);
          dataExportExcel.DataSource = dt;
          dataExportExcel.DataBind();
          dataExportExcel.RenderControl(htmlWrite);
          System.Text.StringBuilder sbResponseString = new System.Text.StringBuilder();
          sbResponseString.Append("&lt;html xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:xlExcel8\" xmlns=\"http://www.w3.org/TR/REC-html40\"&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt;");
          sbResponseString.Append(stringWriter + "&lt;/body&gt;&lt;/html&gt;");
          Response.Write(sbResponseString.ToString());
          Response.End();
  }
  </code></pre>