Link to home
Start Free TrialLog in
Avatar of deloused
deloused

asked on

Gridview number format disappears on export to excel

I am trying to export a gridview to excel with the same formatting that is in my gridview but my formatting is stripped out on the export.

I am loading a gridview with ObjectDataSource.  In the ObjectDataSource I load the data into a dataset with some custom string formating like this:

GridViewField = string.Format("{0:0000000}.{1:00}", numberOne, numberTwo);

It works fine when I view my gridview in the web browser but when I export to excel the numbers are not with this formatting.  How can I force the formatting to be the same for the export to excel?  
ASKER CERTIFIED SOLUTION
Avatar of Munawar Hussain
Munawar Hussain
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of deloused
deloused

ASKER

That sounds like what I need.  What I'm trying to find out though is how to attach that formatting to my gridview cell.  Any ideas on that?
I found it!

http://geekswithblogs.net/AzamSharp/archive/2006/08/12/87804.aspx

needo_jee, you gave me the correct idea to search and this article further explains how to use it with a gridview like I needed.  Thanks for your help!
~welcome