By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,060 Members | 1,906 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,060 IT Pros & Developers. It's quick & easy.

Trouble trying to display integer values

P: n/a
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

--
Message posted via http://www.dotnetmonster.com
Nov 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
If they're "integer" values, they shouldn't have "decimal points"...

"Tim Whelan via DotNetMonster.com" <fo***@nospam.DotNetMonster.com> wrote in
message news:f1******************************@DotNetMonste r.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

--
Message posted via http://www.dotnetmonster.com

Nov 17 '05 #2

P: n/a
Oh I see. I saw "0?s" and misread your post. Check out "composite
formatting" and "Columns, Datagrid Properties" in Books Online

"Michael C#" <xy*@abcdef.com> wrote in message
news:L1*****************@fe11.lga...
If they're "integer" values, they shouldn't have "decimal points"...

"Tim Whelan via DotNetMonster.com" <fo***@nospam.DotNetMonster.com> wrote
in message news:f1******************************@DotNetMonste r.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

--
Message posted via http://www.dotnetmonster.com


Nov 17 '05 #3

P: n/a
"Michael C#" <xy*@abcdef.com> wrote in message
news:ai****************@fe11.lga...
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
Nov 17 '05 #4

P: n/a
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.

"Michael C" <mc*****@NOSPAMoptushome.com.au> wrote in message
news:%2*****************@TK2MSFTNGP15.phx.gbl...
"Michael C#" <xy*@abcdef.com> wrote in message
news:ai****************@fe11.lga...
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

Nov 17 '05 #5

P: n/a
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();
}
}

--
Message posted via http://www.dotnetmonster.com
Nov 17 '05 #6

P: n/a
"Tim Whelan via DotNetMonster.com" <fo***@DotNetMonster.com> wrote in
message news:b5******************************@DotNetMonste r.com...
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
Nov 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.