protected void PopulateControls() { DataTable dt = ItemAccess.GetJieHuanFenXiList(userId, today, type); List.DataSource = dt; List.DataBind(); double zhichuPrice = 0; double shouruPrice = 0; double jieruPrice = 0; double huanchuPrice = 0; double jiechuPrice = 0; double huanruPrice = 0; foreach (DataRow dr in dt.Rows) { zhichuPrice += Double.Parse(dr["ZhiChuPrice"].ToString()); shouruPrice += Double.Parse(dr["ShouRuPrice"].ToString()); jiechuPrice += Double.Parse(dr["JieChuPrice"].ToString()); huanruPrice += Double.Parse(dr["HuanRuPrice"].ToString()); jieruPrice += Double.Parse(dr["JieRuPrice"].ToString()); huanchuPrice += Double.Parse(dr["HuanChuPrice"].ToString()); } this.Label2.Text = zhichuPrice.ToString("0.0##"); this.Label3.Text = shouruPrice.ToString("0.0##"); this.Label4.Text = jiechuPrice.ToString("0.##"); this.Label5.Text = huanruPrice.ToString("0.##"); this.Label6.Text = jieruPrice.ToString("0.##"); this.Label7.Text = huanchuPrice.ToString("0.##"); this.Label8.Text = (shouruPrice - zhichuPrice).ToString("0.0##"); this.Label9.Text = (jiechuPrice - huanruPrice).ToString("0.##"); this.Label10.Text = (jieruPrice - huanchuPrice).ToString("0.##"); }