protected void UpdateData()
        {
            sessionId = Convert.ToInt32(Session["sessionId"]);
            int classId = Convert.ToInt32(Request.QueryString["classId"]);
            Collection <AttendanceCL> attendanceCL = new Collection <AttendanceCL>();

            foreach (GridViewRow item in grdStudent.Rows)
            {
                int          studentId           = Convert.ToInt32(grdStudent.DataKeys[item.RowIndex].Value.ToString());
                AttendanceCL getAttendance       = attendanceBLL.viewAttendanceByStudentIdandDate(studentId, Convert.ToDateTime(txtDate.Text));
                StudentCL    studentCL           = studentBLL.viewStudentById(studentId, sessionId);
                DropDownList ddlStudentLeaveType = item.FindControl("ddlGrdStudentLeaveType") as DropDownList;
                if (Convert.ToInt32(ddlStudentLeaveType.SelectedValue) != -1)
                {
                    attendanceCL.Add(new AttendanceCL()
                    {
                        classId            = classId,
                        date               = Convert.ToDateTime(txtDate.Text),
                        dateCreated        = DateTime.Now,
                        dateModified       = DateTime.Now,
                        isDeleted          = false,
                        studentId          = studentId,
                        studentLeaveType   = ddlStudentLeaveType.SelectedItem.ToString(),
                        studentLeaveTypeId = Convert.ToInt32(ddlStudentLeaveType.SelectedValue),
                        id = getAttendance.id,
                    });
                }
                else
                {
                    if (getAttendance.studentLeaveTypeId != -1)
                    {
                        AttendanceCL deletedAttendance = new AttendanceCL()
                        {
                            id = getAttendance.id,
                        };
                        attendanceBLL.deleteAttendanceCL(deletedAttendance);
                    }
                }
            }
            AttendanceCL attendanceUpdated = attendanceBLL.updateAttendance(attendanceCL);

            lblUpdate.Text = " Entries have been updated. The page will refresh in 5 seconds";
            Response.AppendHeader("Refresh", "5;url=index.aspx");
        }