Trouble trying to display integer values

  • Thread starter Thread starter Tim Whelan via DotNetMonster.com
  • Start date Start date
T

Tim Whelan via DotNetMonster.com

Hi I am developing an asp.net web application using c# and having trouble
trying to display integer values, that I have taken from the database,
correctly on my webform textboxes. The values are consistently displayed
with four 0?s after the decimal point and I am just wondering if anyone
knows how to prevent this from happening. Thanks in advance.
Tadhg88
 
Oh I see. I saw "0?s" and misread your post. Check out "composite
formatting" and "Columns, Datagrid Properties" in Books Online
 
Michael C# said:
Oh I see. I saw "0?s" and misread your post. Check out "composite
formatting" and "Columns, Datagrid Properties" in Books Online

I think you read correctly the first time, I think he meant four 0's after
the decimal point.

Tim, you'll need to explain what you're using to display the values.

Michael
 
Yes, I misread first thinking he had integer values that were being stored
with 4 zeros after a decimal point. I've had similar issues with the
DataGrid control, and had to force the correct formatting using composite
formatting. There might be a better way with Textboxes, but I haven't
really used ASP.NET databound textboxes, so not sure on specifics.
 
sorry guys amateur error they are actually stored in the sql server
database table as "money" and the code im using to display them is

sqlDataAdapter1.Fill(archivedConcertDataSet1);

DataTable archivedConcerts = archivedConcertDataSet1.Tables
["ArchivedConcert"];

foreach(DataRow myRow in archivedConcerts.Rows)
{
if(SelectConcert.SelectedItem.ToString() == myRow[0].ToString())
{
//*** fill textboxes with the concert data
ViewNumOfPerformances.Text = myRow[1].ToString();
ViewFeesDue.Text = myRow[2].ToString();
ViewPercentageOfTicketSales.Text = myRow[3].ToString();
ViewTotalTicketSales.Text = myRow[4].ToString();
ViewProfitOrLoss.Text = myRow[5].ToString();
}
}
 
Tim Whelan via DotNetMonster.com said:
sorry guys amateur error they are actually stored in the sql server
database table as "money" and the code im using to display them is

try ToString("0")

Michael
 
Back
Top