I have code for exporting to Excel. In my gridview I set paging to display the number of records in pagecount.
But in my export to Excel it is not giving me entire records, instead it is showing me the same paging with six records.
My 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();
How do I change or disable the paging to get all the records from my gridview?
I have numbers in gridview as +9199, etc., but after exporting it it is showing me it in the format of 9.99, etc.
How do I pass the formatcells in numbers from here?