protected void btnYes_Click(object sender, EventArgs e) { if (Page.IsValid) { // Check is there a query string "classid" in the URL if (Request.QueryString["classId"] != null) { // Create a Student object. ClassStudent objStudent = new ClassStudent(); objStudent.ParentID = Convert.ToInt32(Session["LoginID"]); objStudent.StudentName = txtStudentName.Text; objStudent.TuitionClassID = Convert.ToInt32(lblTuitionClassID.Text); int errorCode = objStudent .add(); if (errorCode == 0) { // Display appropriate message lblMessage.Text = "Class registered successfully."; // Disable "Yes" and "No" buttons, btnYes.Enabled = false; btnNo.Enabled = false; //Display link back to the view staff page lnkReturn.Visible = true; } } } }
protected void cuvDeleteClass_ServerValidate(object source, ServerValidateEventArgs args) { if (Page.IsValid) { ClassStudent objClassStudent = new ClassStudent(); if (objClassStudent.studentNull(Convert.ToInt32(lblTuitionClassID.Text)) == false) { args.IsValid = false; btnYes.Enabled = false; btnNo.Enabled = false; lnkViewClassSchedule.Visible = true; } else { args.IsValid = true; } } }