protected void grdCus_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete") { int i = Convert.ToInt32(e.CommandArgument); dt = AdminChongZhiMsgBLL.GetAdminChongZhiMsg(txt_StartTime.Value, txt_EndTime.Value); string id = dt.Rows[i]["id"].ToString(); AdminChongZhiMsgBLL.DeleteAdminChongZhiMsg(id); MsgDataBind(); Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script type='text/javascript' defer=defer>alert('删除成功!');</script>"); } }
private void MsgDataBind() { try { dt = AdminChongZhiMsgBLL.GetAdminChongZhiMsg(txt_StartTime.Value, txt_EndTime.Value); grdCus.DataSource = dt; grdCus.DataBind(); } catch (Exception ex) { ExceptionReporter.WriteLog(ex, ExceptionPostion.TBApply_Web_UI); } }