DataGridItemEventArgs dataitem decimal value rounding

G

Guest

In a datagrid's itemdatabound sub, I've got a dataitem for a SQL Server field
of type decimal (3,2) with a value of 0.99. Query is straightforward: Select
* from tablename. When I use a watch to check the dataitem value, it shows as
1D. If I use a watch to look at the cell text (e.item(i).text) it shows the
correct "0.99" value. Anyone know why the dataitem would show a rounded value
and how to make it stop?

tia,
Sue
 
G

Guest

Hi Sue,

If you're using .NET 1.1, have you tried the DataFormatString attribute of
the BoundColumn? You can specify it as DataFormatString="{0:n}" which formats
the data with 2 decimal places.

Hope that helps,
Calvin
 
G

Guest

Hi Calvin. Yes, the DataFormatString is already there to make sure that at
least two decimal places display, even if they're a zero value.
Unfortunately, in this instance, the value displayed is 1.00, even though it
s/b 0.99.

thanks though!
Sue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top