Error while exporting to Excel with Gridview

Hello all,

I'm getting some errors while exporting the data in my gridview to excel. I have a column called account number which is not showing properly in Excel.

For example, the account number 9001022199001 is showing up as 9.00103E+12. But when I click on the field in Excel, it shows up correctly. I think its a formatting error in Excel but I'm not sure if the problem is Excel or my code.  

How can I fix this problem?
protected void Button1_Click(object sender, EventArgs e)
        GridView gTempViewForExcelExport = new GridView();
        gTempViewForExcelExport.DataSource = m_dsContractorData;
        gTempViewForExcelExport.AllowPaging = false;
        GridViewExportToExcel.Export("BulkExtract.xls", gTempViewForExcelExport);
    protected void gvUsers_RowDataBound(object sender, GridViewRowEventArgs e)
        if (((GridViewRowEventArgs)e).Row.RowType == DataControlRowType.DataRow)
            ((GridViewRowEventArgs)e).Row.Cells[1].Attributes.Add("class", "text");

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Discussed here:

The code snippets there look to be what you're after

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bob LearnedCommented:
Wow, pointing to an article that the asker asked in a different forum--what are the odds *BIG GRIN*.
Sorry - my bad - I didn't look at the usernames!
AvinashKNAuthor Commented:
Haha, It's ok. I obviously figured out what to do. Thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.