62,047
社区成员
发帖
与我相关
我的任务
分享
string str = Request["chAll"];
<asp:TemplateField>
<HeaderTemplate>
<input id="chAll" type="checkbox" runat="server" onclick="SelectAll(this)" />
</HeaderTemplate>
<ItemTemplate>
<input id="chChild" name="chChild" type="checkbox" runat="server"/>
</ItemTemplate>
</asp:TemplateField>
protected void btnDelete_Click(object sender, ImageClickEventArgs e)
{
for (int i = 0; i < GridView1.Rows.Count; i++)
{
HtmlInputCheckBox checkbox = (HtmlInputCheckBox)GridView1.Rows[i].FindControl("chChild");
//Response.Write("<script>window.alert('" + checkbox.Checked.ToString() + "');</script>");
if (checkbox.Checked)
{
int id = Convert.ToInt32(GridView1.DataKeys[i].Value);
Response.Write("<script>window.alert('"+ id.ToString() +"');</script>");
//notice.Delete(id);
}
}
notice.Delete(4);
Response.Write("<script>window.alert('删除成功!');window.location.href='NoticeList.aspx';</script>");
}