473,388 Members | 1,346 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Problem with floating points in datagrid

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
Nov 19 '05 #1
1 909
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

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"Anders K. Jacobsen [DK]" <no**@at.all> wrote in message
news:OP**************@TK2MSFTNGP14.phx.gbl...
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

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: David E. | last post by:
Here's somewhat of an interesting problem. I am creating a class called Rectangle. It takes in 4 sets of Cartesian coordinates (i.e. (x,y) coordinates.). I'm assuming that the rectangle can be...
0
by: Michael Hall | last post by:
Hi All: I'm a relative newbie to Python, apart from some CGI and shell scripting type stuff. Anyway, I'm having some problems doing maths in Python 2.2.2 on RH9. I'm wondering what is the best...
10
by: Mr Doppino | last post by:
Hi people, I would like to submit a problem about double comparison. Here's the code: struct Cross_point { int cross_id; int x, y; int street_oriz, street_vert; }; ...
5
by: towers | last post by:
Hello, I've got a bit of experience in C++, but I'm writing my first app that is dependent on relatively precise math functions. The app requires that I get a time stamp based on s sample...
13
by: Bern McCarty | last post by:
I have run an experiment to try to learn some things about floating point performance in managed C++. I am using Visual Studio 2003. I was hoping to get a feel for whether or not it would make...
1
by: Kevin Hodgson | last post by:
I'm having a strange problem with a VB.NET App, and the built in Windows.Forms.Datagrid I have a tabbed interface, and a DataGrid (along with other controls) on each of my two Tabs. If the...
39
by: Martin Jørgensen | last post by:
Hi, I'm relatively new with C-programming and even though I've read about pointers and arrays many times, it's a topic that is a little confusing to me - at least at this moment: ---- 1)...
18
by: atv | last post by:
at least to me it is. I can't figure out for the life what it is i'm doing wrong here. i have a function called assign_coordinate. usually, i pass a malloced pointer to it, then individual...
7
by: bummerland | last post by:
Hi, I have a problem with the function fmod. Why is fmod(5.7, 0.1) = 0.1 ?? Why is it not 0? tia bummerland
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.