1: 2: 3: 4: 5: 6: 7: 8:
string strNumber = "1234"; string strFormat = string.Empty; if (strNumber.Contains(".")) strFormat = "#,###.#0"; else strFormat = "#,###"; Response.Write("Number = " + Convert.ToDecimal(strNumber).ToString(strFormat));