コード例 #1
0
        protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "DeSelect")
            {
                int row;
                try
                {
                    row = System.Convert.ToInt32(e.CommandArgument);
                }
                catch (Exception ex)
                {
                    Response.Write(ex.Message);
                    row = -1;
                }

                string course_schedule_id = GridView2.Rows[row].Cells[0].Text;

                string stu_id = Session["account_user_id"].ToString();

                bool isChanged = CourseSelectDBUtil.Delete(course_schedule_id + stu_id);
                if (isChanged)
                {
                    string toastrScript = ToastrHelper.GetToastrScript("success", "提示", "退选成功。");
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true);
                }
                else
                {
                    string toastrScript = ToastrHelper.GetToastrScript("danger", "提示", "退选失败。");
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true);
                }
                Data_Bind();
            }
        }
コード例 #2
0
        protected void Button_Delete_Click(object sender, EventArgs e)
        {
            string course_select_id = Input_Delete_Course_Select_ID.Text;
            bool   isChanged        = CourseSelectDBUtil.Delete(course_select_id);

            if (isChanged)
            {
                string toastrScript = ToastrHelper.GetToastrScript("success", "提示", "删除选课信息成功。");
                ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true);
            }
            else
            {
                string toastrScript = ToastrHelper.GetToastrScript("danger", "提示", "删除选课信息失败。");
                ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "script", toastrScript, true);
            }
            Data_Bind();
        }