protected void Page_Load(object sender, EventArgs e) { try { DataTable dt = new DataTable(); dt.Columns.Add("SOT", typeof(Decimal)); dt.Columns.Add("SVT", typeof(Decimal)); dt.Columns.Add("SCT", typeof(Decimal)); dt.Rows.Add(12.22, 23.44, 22.00); dt.Rows.Add(2.20, 23.00, 22.23); dt.Rows.Add(12.00, 23.20, 22.05); GridView1.DataSource = dt; GridView1.DataBind(); } catch (Exception d) { Response.Write(d.Message.ToString()); } }
12
12.00
Decimal
Try like below: dt.Rows.Add(12.22m, 23.44m, 22.00m); or Math.Round((Double)12.22, 2)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)