统计GridView某一列值的总和放在label中

来源:互联网 发布:金融的网络销售 编辑:程序博客网 时间:2024/06/05 19:48
double sum = 0.00;for (int i = 0; i < this.GridView1.Rows.Count; i++){try{sum += Convert.ToDouble(this.GridView1.Rows[i].Cells[5].Text.Trim());//针对模板列的方法然后对s处理string s = GridView1.Rows[i].Cells[2].FindControl("lblSalary") as Label).Text.ToString();}catch{continue;}}this.labTotalPayNum.Text = sum.ToString("c");


原创粉丝点击