用模板列
<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");
//在这里处理你想要的数据
}
}
转载于:https://www.cnblogs.com/feilong3540717/archive/2011/12/27/2304144.html