Hi Ppl,
I am exporting the Gridview to Excel using HttpContext.Current.Response.Output.Write. In Gridview i am having the Date column. While Exporting to Excel in Excel sheet i cant able to do shorting in Datecolumn.
To know the Format of the Cell. I checked the corresponding Excel Column Formate Type, it showing as General.
If any one knows the answer pls post it..
Thank you for your Time
Arun T
Loading

Ring ZhongRank #6,843 · 255 reputationPosted Dec 19, 2013, 11:09 PM EST
http://forums.asp.net/t/1255489.aspx
ALSO
you can use another method, it's easier to operate:
hope it helps.
Arun T14 reputationPosted Dec 22, 2013, 9:17 PM EST
Balakrishnan P10 reputationPosted Dec 26, 2013, 1:33 AM EST
Tirthak Shah196 reputationPosted Dec 26, 2013, 3:11 AM EST
{
/* Verifies that the control is rendered */
}
protected void btnexport_Click(object sender, EventArgs e)
{
Response.ClearContent();
Response.AddHeader("content-disposition",
"attachment;filename=Candidate_Inquiry.xls");
Response.ContentType = "applicatio/excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htm = new HtmlTextWriter(sw);
gvcategory.BorderWidth = 1;
gvcategory.AllowPaging = false;
BindCategory();(Bind Your Griedview Here)
for (int i = 0; i < gvcategory.HeaderRow.Cells.Count; i++)
{
gvcategory.HeaderRow.Cells[i].Style.Add("background-color", "#CCCCCC");
gvcategory.HeaderRow.Enabled = false;
}
gvcategory.RenderControl(htm);
Response.Write(sw.ToString());
Response.End();
}
This Is the Code Try It.
It Will Definately Help You.Its Works For Me.
Thanks,
Tirthak Shah
Nicholas Barns12 reputationPosted May 14, 2014, 3:50 AM EDT
Also you can try another approach by using this C# Excel library, something like the following: