Hi,
I have a problem.
One of the datatable colums value is a string value '001200' for example.
When the Excel document creats the value became '1200'.
How can I keep a data format as is?
I'm working with ASP.NET 1.1.
The part of the code is:
private void lnkExport_Click( object sender, System.EventArgs e )
{
Response.Clear();
Response.Buffer= true;
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader( "Content-Disposition", "attachment; filename=" + "CartsList.xls" );
Response.Charset = "iso-8859-8";
Response.Cache.SetCacheability( HttpCacheability.Public );
Response.ContentEncoding = System.Text.Encoding.UTF7;
this.EnableViewState = false;
System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter( oStringWriter );
this.ClearControls( dtgCarts );
dtgCarts.RenderControl( oHtmlTextWriter );
Response.Write( oStringWriter.ToString() );
Response.End();
}
Thank you.