示例#1
0
        protected void dataGrid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string id   = e.CommandArgument.ToString();
            string name = e.CommandName.ToString();

            if (name == "cmdUpdate")
            {
                string js = "update('" + id + "');";
                // litJs.Text = " <script language='javascript'>" + js + "</script>";
                ScriptManager.RegisterStartupScript(UpdatePanel1, typeof(UpdatePanel), "customJs", js, true);
                //ScriptManager.RegisterStartupScript(this, typeof(Page), "customJs", js, false);
            }
            else
            {
                //cmdDelete
                HYCashierDAL.CahierMgrDAL dal = new HYCashierDAL.CahierMgrDAL();
                if (dal.DeleteOpr(id))
                {
                    ScriptManager.RegisterStartupScript(UpdatePanel1, typeof(UpdatePanel), "customJs", "alert('删除成功');", true);
                    LoadData();
                }
                else
                {
                    ScriptManager.RegisterStartupScript(UpdatePanel1, typeof(UpdatePanel), "customJs", "alert('删除失败,请重试')", true);
                }
            }
        }
示例#2
0
        protected void btnDelete_Command(object sender, CommandEventArgs e)
        {
            string id   = e.CommandArgument.ToString();
            string name = e.CommandName.ToString();

            HYCashierDAL.CahierMgrDAL dal = new HYCashierDAL.CahierMgrDAL();
            if (dal.DeleteOpr(id))
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, typeof(UpdatePanel), "customJs", "alert('删除成功');", true);
                LoadData();
            }
            else
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, typeof(UpdatePanel), "customJs", "alert('删除失败,请重试')", true);
            }
        }