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. Advertisements

  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. Advertisements

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:
    2,098
    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:
    971
    Eric Sosman
    Jul 8, 2003
  3. bandw
    Replies:
    5
    Views:
    727
    bandw
    Jul 7, 2005
  4. Daniel Rudy

    unsigned long long int to long double

    Daniel Rudy, Sep 19, 2005, in forum: C Programming
    Replies:
    5
    Views:
    1,577
    Peter Shaggy Haywood
    Sep 20, 2005
  5. Mathieu Dutour

    long long and long

    Mathieu Dutour, Jul 17, 2007, in forum: C Programming
    Replies:
    4
    Views:
    697
    santosh
    Jul 24, 2007
  6. darrel
    Replies:
    4
    Views:
    1,005
    darrel
    Jul 19, 2007
  7. Bart C

    Use of Long and Long Long

    Bart C, Jan 9, 2008, in forum: C Programming
    Replies:
    27
    Views:
    1,242
    Peter Nilsson
    Jan 15, 2008
  8. Problem transfering datagrid to Excel

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