decimal format

  • Thread starter Adam The Generic
  • Start date
A

Adam The Generic

Hi All,

I'm working on an asp.net report page that will allow the user to query some
data from a sql server database and output it on a GridVew object.
All returning data is decimal and has 4 scale.
Columns data types is Decimal(28,4) on sql server.

I am using "{0:#,0.0000}" string expression on ItemTemplate section of the
GridView object.

But the users want to see decimal values without a ineffective zero after
the decimal separator (in fraction part)
like that:

4145,1254 --> 4.145,1254
4012,1010 --> 4.012,101
712,7800 --> 712,78
44124,7000 --> 44.124,7
7104577,0000 --> 7.104.577

How can i support that ?

Thanks in advance...
 
A

Adam The Generic

Thanks Peter,

I have seen that blog before, but there is no sample to get rid of all
ineffective zeroes ( trailing zeroes) on the fractional part.

All samples depend on the fixed number for fractional part.

for example, in 4145,7800, the last two zeroes are trailing zeroes, and i
need to get ride of them and find the 4.145,78
for 4145,7890 as another sample the last zero is a trailing zero i need
4.145,789
 
A

Adam The Generic

Yes Peter,

You are right.
My bad.

If i use # instead of 0, it removes all trailing zeros.
i try {0:#,####0.####}, and it works fine for now.

Thanks again..
 

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,769
Messages
2,569,582
Members
45,066
Latest member
VytoKetoReviews

Latest Threads

Top