protected void Delete_Material_Click(object sender, EventArgs e) { UserBO ob = new UserBO(); ob.coursematerial = Filenamenat.Text; clsBLL ok1 = new clsBLL(); int kira = ok1.updatetheQuestionBLL(ob); if (kira == 1) { Statusindicator.Text = "deleted"; Response.Redirect("AdminAddCourseMaterial.aspx"); } else { Statusindicator.Text = "not deleted"; } }
protected void QuestionsData_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Select") { int rowIndex = Convert.ToInt32(e.CommandArgument); GridViewRow row = QuestionsData.Rows[rowIndex]; int qnodel = Convert.ToInt32(row.Cells[1].Text); string coursedel = row.Cells[2].Text; UserBO ob = new UserBO(); ob.qno = qnodel; ob.coursecode = coursedel; clsBLL obj = new clsBLL(); if (obj.deletetheQuestionBLL(ob) == 1) { if (obj.updatetheQuestionBLL(ob) >= 0) { Response.Write("<script>alert('Deleted QuestionSuccessfully');</script>"); using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["userdataConnectionString"].ConnectionString.ToString())) { SqlCommand cmd = new SqlCommand("select * from QuestionBank where (CourseID ='" + CourseCodeDropList.Text + "')", con); con.Open(); QuestionsData.DataSource = cmd.ExecuteReader(); QuestionsData.DataBind(); } } } else { Response.Write("<script>alert('Question can't be deleted');</script>"); } } }