Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Display format problem in excel sheet.

Posted on 2004-09-22
3
440 Views
Last Modified: 2010-04-17
We are using C# language. The sql query data is dumped to excel sheet through data grid.
The number field is not properly displayed. The number 100003434 is displayed as 2.233456E.11.
But we need to display as 100003434.
below is the code used.


public class ExcelProblemInvoice : System.Web.UI.Page
      {
private string strVendorID = "";
protected System.Web.UI.WebControls.DataGrid datagridProblemInvoice;

private void Page_Load(object sender, System.EventArgs e)
{                  
try
{
if (Session["SESSION_USER_ID"] != null && Session["SESSION_USER_ID"].ToString() != "")
      {
      strVendorID = Session[ApplicationConstants.vendorID].ToString();
                  // Put user code to initialize the page here
                        Response.Clear();
                        Response.Charset = "";
                        Response.ContentType = "application/vnd.ms-excel";            
            System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);                
Controller controller = new Controller();
DataSet dataProblemInvoice = controller.SearchExcel(strVendorID );

      datagridProblemInvoice.DataSource = dataProblemInvoice;                                    
                        datagridProblemInvoice.DataBind();

                        datagridProblemInvoice.RenderControl(htmlWrite);

                        Response.Write(stringWrite.ToString());
                        Response.End();
                  }
0
Comment
Question by:ivega
3 Comments
 
LVL 3

Accepted Solution

by:
PodExpert earned 125 total points
ID: 12130986
You have to use some string formating routine to convert your number to an appropriate format. String formating in C# is well explained here:

http://www.codeproject.com/csharp/custstrformat.asp

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an explanation of a simple data model to help parse a JSON feed
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question