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

Discussion in 'ASP .Net' started by RSB, Nov 10, 2004.

  1. RSB

    RSB Guest

    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();
    }
    RSB, Nov 10, 2004
    #1
    1. Advertising

  2. RSB

    David Jessee Guest

    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" <> wrote in message
    news:ySwkd.2759$...
    > 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();
    > }
    >
    >
    David Jessee, Nov 11, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    3
    Views:
    1,946
    Alvin Bruney [MVP - ASP.NET]
    May 29, 2005
  2. George Marsaglia

    Assigning unsigned long to unsigned long long

    George Marsaglia, Jul 8, 2003, in forum: C Programming
    Replies:
    1
    Views:
    674
    Eric Sosman
    Jul 8, 2003
  3. bandw
    Replies:
    5
    Views:
    607
    bandw
    Jul 7, 2005
  4. darrel
    Replies:
    4
    Views:
    817
    darrel
    Jul 19, 2007
  5. Problem transfering datagrid to Excel

    , May 24, 2005, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    120
Loading...

Share This Page