How to display values only upto 2 decimal places
Format in presentation layer:
string.Format("{0:#.##}", value);
Well, I tried it and got the correct result.
Below is the code that I used:
funding.amount= Math.Round(decimal.Parse(dr["Amount"].ToString()), 2).ToString();
//since the amount was of string type, therefore I used the above code. we can also use the below code:
decimal.Round(yourValue, 2, MidpointRounding.AwayFromZero);
http://msdn.microsoft.com/en-us/library/9s0xa85y.aspx
Read Custom Numeric Formats for detailed instructions on formatting numbers.
value.ToString("0.00");
In C# 6 or later, you can use string interpolation for a somewhat cleaner syntax.
$"{value:0.00}";
string.Format("{0:0.00}", your_value);