lable 标签的值 =gridview 的某列的和 怎么写

来源:百度知道 编辑:UC知道 时间:2024/05/31 22:46:48
lable 标签的值 ==gridview 的某列的和 怎么写
或者我不用lable 前台直接用 response.write 可以吗!~~
谢谢各位大哥

Response.Write()会显示在html的最上面,也就是说它显示后不是包含在<html></html>里面,所以最好别使用.

在GridView数据绑定完成后:
int totalValue = 0;
foreach(GridViewRow row in this.GirdView1.Rows)
{
totalValue += Convert.ToInt32(row.Cells[n].Text);
}

this.Lable1.Text = "总值为" + totalValue;

保证第n个单元格可以转换成int型