日期:2014-05-17 浏览次数:20442 次
//删除按钮事件
protected void btnDelete_Click(object sender, EventArgs e)
{
for (int i = 0; i < this.GridView1.Rows.Count; i++)
{
HtmlInputCheckBox cb = (this.GridView1.Rows[i].FindControl("chkSelect")) as HtmlInputCheckBox;//获取复选框
int id = Int32.Parse(this.GridView1.DataKeys[i].Value.ToString());
if (cb.Checked)
{
m_customerBLL.DeleteModel(id);
}
}
}
<asp:TemplateField HeaderText="选择">
<ItemTemplate>
<input type="checkbox" id="chkSelect" runat="server" />