Example #1
0
        protected void LinkButtonDelete_Click(object sender, EventArgs e)
        {
            LinkButton  lb = (LinkButton)sender;
            HiddenField hd = (HiddenField)lb.FindControl("HiddenFieldStudID");

            int studentID = int.Parse(hd.Value);

            var ac = new AttendanceControl();

            var studentToRemove = studentsControl.GetAllStudents().Where(x => x.Id == studentID).FirstOrDefault();

            if (studentToRemove.Attendance.Count > 0)
            {
                ac.RemoveAttendanceByStudentID(studentID);
            }
            if (studentToRemove != null)
            {
                studentsControl.RemoveStudent(studentID);

                var pc = new PeopleControl();

                pc.RemovePeople(studentToRemove.PersonId);
            }



            BindGrid();
        }