protected void gvResourceList_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Del") { int val = ResourceInfoManager.Delete(Convert.ToInt32(e.CommandArgument)); if (val != 0) { this.ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('删除成功')</script>"); ucpage_onLoadPageIndexChaning(ucpage.PageIndex); } } }
protected void btnDelete_Click(object sender, EventArgs e) { int[] ids = new int[gvResourceList.Rows.Count]; for (int a = 0; a < gvResourceList.Rows.Count; a++) { if ((gvResourceList.Rows[a].FindControl("cbCheck") as CheckBox).Checked) { ids[a] = Convert.ToInt32(gvResourceList.Rows[a].Cells[0].Text.Trim()); } } foreach (int riid in ids) { if (riid != 0) { ResourceInfoManager.Delete(riid); } } ucpage_onLoadPageIndexChaning(ucpage.PageIndex); }