遍历GridView中的checkbox

用模板列
<asp:TemplateField HeaderText="删除" ShowHeader="False">
  <ItemTemplate>
  <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" OnClientClick=" javascript:return confirm('你确认要删除吗?')"
  CommandName="Delete" Text="删除"></asp:LinkButton>
  </ItemTemplate>
 </asp:TemplateField>



然后:
protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
  {
  foreach (GridViewRow row in GridView1.Rows)
  {
  CheckBox CheckBox1 = (CheckBox)row.Cells[4].FindControl("CheckBox1");  
  //在这里处理你想要的数据
  }

  }

posted @ 2011-12-27 23:21  @龙飞凤舞@  阅读(1407)  评论(0编辑  收藏  举报