private void butDelete_Click(object sender, EventArgs e) { if (_groupCur.IsNew) { DialogResult = DialogResult.Cancel; return; } try { UserGroups.Delete(_groupCur); DialogResult = DialogResult.OK; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { if (BasePage.RequestString("Action") == "Delete") { int id = BasePage.RequestInt32("GroupId"); if (id == -2) { AdminPage.WriteErrMsg("匿名会员组不能删除!", "UserGroupManage.aspx"); } if (UserGroups.Delete(id)) { AdminPage.WriteSuccessMsg("删除成功!", "UserGroupManage.aspx"); } } }