int rowindex;
foreach (GridViewRow gvr in gv.Rows)
{
System.Web.UI.WebControls.CheckBox cb = new CheckBox(); //定义一个控件
cb = (CheckBox)gvr.FindControl("CheckBox1"); //找到一个控件并把值给新定义的控件
if (cb.Checked)
{
rowindex = gvr.RowIndex;
DataKey key = gv.DataKeys[rowindex];
string Handicaps = key.Value.ToString();
handicaps.Value = handicaps.Value.ToString().Trim() + Handicaps + "|";
}
}