日期:2014-05-17 浏览次数:20573 次
sum += Convert.ToDouble(e.Row.Cells[4].Text)*0.7 + Convert.ToDouble(e.Row.Cells[5].Text)*0.2 + Convert.ToDouble(e.Row.Cells[6].Text)*0.1; 把这个分开,一个一个写! double a = Convert.ToDouble(e.Row.Cells[4].Text == "" ? 0 : e.Row.Cells[4].Text); double b = Convert.ToDouble(e.Row.Cells[5].Text == "" ? 0 : e.Row.Cells[5].Text); double c = Convert.ToDouble(e.Row.Cells[6].Text == "" ? 0 : e.Row.Cells[6].Text); sum += a+b+c;
------解决方案--------------------
//1. if (e.Row.Cells[4].Text.ToString() != "") { //处理 } //2. //模板列的话这么处理 TextBox txtPrice = e.Row.FindControl("tbPrice") as TextBox; if (txtPrice.Text.ToString() == "") { //处理 } else { //处理 }