DataGridItemEventArgs dataitem decimal value rounding

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
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

Back
Top