954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Problem in writing from a datagrid to Excel..

Hi all..
I have a aspx page with a datagrid holding values in it..I need to write the datagrid values in the excel for which i use the following code..
Private Sub btnexcel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnexcel.Click
Response.Clear()
Response.AddHeader("content-disposition", "attachment;filename=FileName.xls")
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.Public)
Response.ContentType = "application/vnd.xls"
Dim stringWrite As New System.IO.StringWriter
Dim htmlwrite As New System.Web.UI.HtmlTextWriter(stringWrite)
dtgdisplay.RenderControl(htmlwrite)
Response.Write(stringWrite.ToString())
Response.End()
End Sub

Everything is ok..But the datagrid contains column and rows with numeric values(16 digits).So when i write it in excel i am getting them in scientific format..Even when i am formatting the cells ,i couldn't the exact values which are in the datagrid..
Someone help in this regard...

Balagurunathan s

BalagurunathanS
Light Poster
26 posts since Apr 2007
Reputation Points: 10
Solved Threads: 0
 

Hi ,

I am also having the same problem. I am exporting 16 digit Acct # from Datagrid to excel in asp.net and it export 15 digit properly and place 0 for 16 digit.

Would u please tell me the solution how u did that?

Thanks

sarad
Newbie Poster
1 post since Aug 2008
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You