By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,009 Members | 2,821 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,009 IT Pros & Developers. It's quick & easy.

How to Stop Long Numeric to Scientific Conversion if Transfering data from DataGrid to Excel.

P: n/a
RSB
Hi Everyone,
i am using the following code to transfer a DataGrid to Excel File.
Every thing works ok beside the long numerice value like 0000121900000000
gets converted to 1.219E+11.
how can i disable that conversion?
Thanks for the Help

RSB

public static void DataGridToExcel(DataGrid dgExport, HttpResponse
response){
response.Clear();
response.Charset = "";
response.ContentType = "application/vnd.ms-excel";
StringWriter stringWrite = new StringWriter();
HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
DataGrid dg = new DataGrid();
dg = dgExport;
dg.AllowPaging = false;
dg.AllowSorting = false;
dg.GridLines = GridLines.Both;
dg.HeaderStyle.Font.Bold = true;
dg.DataBind();
dg.RenderControl(htmlWrite);
response.Write(stringWrite.ToString());
response.End();
}
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Well, its not converting....its just a formatting issue. I don't know what
your class is doing as far as exporting the data, so I can't tell you
exactly how to do it. But approach it as a formatting issue
"RSB" <rs*****@hotmail.com> wrote in message
news:yS****************@news.cpqcorp.net...
Hi Everyone,
i am using the following code to transfer a DataGrid to Excel File.
Every thing works ok beside the long numerice value like 0000121900000000
gets converted to 1.219E+11.
how can i disable that conversion?
Thanks for the Help

RSB

public static void DataGridToExcel(DataGrid dgExport, HttpResponse
response){
response.Clear();
response.Charset = "";
response.ContentType = "application/vnd.ms-excel";
StringWriter stringWrite = new StringWriter();
HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
DataGrid dg = new DataGrid();
dg = dgExport;
dg.AllowPaging = false;
dg.AllowSorting = false;
dg.GridLines = GridLines.Both;
dg.HeaderStyle.Font.Bold = true;
dg.DataBind();
dg.RenderControl(htmlWrite);
response.Write(stringWrite.ToString());
response.End();
}

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.