Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Display format problem in excel sheet.

Posted on 2004-09-22
3
Medium Priority
?
446 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 500 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

[Webinar] Cloud Security

In this webinar you will learn:

-Why existing firewall and DMZ architectures are not suited for securing cloud applications
-How to make your enterprise “Cloud Ready”, and fix your aging DMZ architecture
-How to transform your enterprise and become a Cloud Enabler

Question has a verified solution.

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

In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Introduction to Processes

916 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