Convert integer to two decimal places using C#

droiddeve
 
on Nov 25, 2016 01:53 AM
9630 Views

Hi,

I want toknow that How to convert the value of text from 1- 1.00

or 10 -10.00 

am using this code

txtstartRange.Text = String.Format("{0:N1}",.0);

but output is From this code is 0.00



 

Download FREE API for Word, Excel and PDF in ASP.Net: Download
dharmendr
 
on Nov 25, 2016 01:54 AM

Hi droiddeve,

 Refer the below code.

string no = "1";
string text = string.Format("{0:N2}", Convert.ToDecimal(no));