Round to 2 decimals in a Datalist

  • Thread starter Thread starter Christine
  • Start date Start date
C

Christine

Hi,
I am creating a datalist and have the following lines of code:

<tr><td>'<%#DataBinder.Eval(Container.DataItem, "PBBLS")%>'</td></tr>
<tr><td>'<%#DataBinder.Eval(Container.DataItem, "SBBLS")%>'</td></tr>

I need to round PBBLS and SBBLS up to 2 decimal places. There are
currently 4. I am getting these values from an OleDb Connection inside
of a table.
Any help would be appreciated. Thanks!
 
I changed the code to:

'<%#Math.Round(DataBinder.Eval(Container.DataItem, "PBBLS"), 2)%>'

And it works great! Thanks.
 

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