title: Export to Excel from gridview
body: <p>I have code for exporting to Excel. In my gridview I set paging to display the number of records in pagecount.</p>
  
  <p>But in my export to Excel it is not giving me entire records, instead it is showing me the same paging with six records.</p>
  
  <p>My code:</p>
  
  <pre><code>string attachment = "attachment; filename=Contacts.xls";
  Response.ClearContent();
  Response.AddHeader("content-disposition", attachment);
  Response.ContentType = "application/ms-excel";
  StringWriter sw = new StringWriter();
  HtmlTextWriter htw = new HtmlTextWriter(sw);
  
  // Create a form to contain the grid
  HtmlForm frm = new HtmlForm();
  
  GrdDynamicControls.AllowPaging = false;
  GrdDynamicControls.Parent.Controls.Add(frm);
  
  frm.Attributes["runat"] = "server";
  frm.Controls.Add(GrdDynamicControls);
  frm.RenderControl(htw);
  
  //GridView1.RenderControl(htw);
  Response.Write(sw.ToString());
  Response.End();
  </code></pre>
  
  <p>How do I change or disable the paging to get all the records from my gridview?</p>
  
  <p>I have numbers in gridview as +9199, etc., but after exporting it it is showing me it in the format of 9.99, etc.</p>
  
  <p>How do I pass the formatcells in numbers from here?</p>