Tuesday, July 12, 2011

Rounding a value in asp.net

Rounding a decimal value in ASP.NET is very easy.
Example:
decimal total = 10.2450;
total = Math.Round(total, 2);
Here Math.Round has eight overloaded function which return different rounding value according to user needs.
In above example I need to round my total value in 2 decimal place. So I total variable and 2 integer in the function which return a decimal value with 2 integer precision.

No comments:

Post a Comment

Search This Blog

Visitor Counter