int sum = 0;
for (int i = 0; i < this.GridView1.Rows.Count; i++)
{
GridViewRow row=this.GridView1.Rows[i];
sum=sum+Convert.ToInt32(row.Cells[21].Text.ToString());
}
Response.Write(sum.ToString());
还有一种方法:
BLL.newline bllnewline = new BLL.newline();
foreach (GridViewRow gvr in gvnextshengchan.Rows)
{
CheckBox ch = (CheckBox)gvr.FindControl("CheckBox1");
if (ch.Checked)
{
string proname = gvr.Cells[4].Text;
}
}
转载于:https://www.cnblogs.com/J2EEPLUS/archive/2010/06/06/2487928.html