Problem with floating points in datagrid

  • Thread starter Anders K. Jacobsen [DK]
  • Start date
A

Anders K. Jacobsen [DK]

Hi

I have a MSSQL database with has alot of numeric(18,2). I use LLBLGenPro as
O/R and it presents them as Decimals.

Fine. When i databind these O/R objects to a datagrid it "sees" that it´s 2
decimals and print it like: 14.00 even when no numbers are supplied.

The customer demand is now that when no the number is xx.00 it should be xx
and when xx.y0 it should be xx.y . Eg 14.00 => 14 and 14.70 => 14.7

I know i problably could change this dynamic parsing at dataBound event but
jeee thats a lot of redudant work.

Can you guys think of a smart "genric"´er way to achive this? My brain can
come up with anything near a smart solution.

Thanks in regards. Really.!

Anders
 
K

Karl Seguin

Anders:
This is normally done one of three ways...

1-expose a new readonly property in your entities which provide the
formatted number (you say you have a lot so this might not be the best
approac)

use inline formatting (2) or the onItemDataBound event (3)
http://openmymind.net/index.aspx?documentId=8


Karl
 

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

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,042
Latest member
icassiem

Latest Threads

Top