protected void btnSEARCH_Click(object sender, EventArgs e)
    {
        utility utlObj = new utility();
        UInt64  chknum;

        txtSTD_FIRSTNAME.Text  = "";
        txtSTD_SURNAME.Text    = "";
        txt_STD_FACULTY.Text   = "";
        txtSTD_DEPARTMENT.Text = "";
        txtSTD_MAJOR.Text      = "";
        txtSTD_SPEC_FIELD.Text = "";

        btnSAVE.Enabled = false;
        btnEdit.Enabled = false;

        Session.Remove("save_student_data");

        if (txtSTUDENT_ID.Text.Length != 13)
        {
            divShow.Visible = false;
            MsgValidate("กรุณาระบุ รหัสนักศึกษาด้วยตัวเลข 13 หลัก");
        }
        else if (!UInt64.TryParse(txtSTUDENT_ID.Text, out chknum))
        {
            MsgValidate("กรุณาระบุ รหัสนักศึกษาด้วยตัวเลขเท่านั้น");
        }
        else
        {
            divFail.Visible = false;
            string degree_admission = utlObj.getFactorFromStudentID(txtSTUDENT_ID.Text, utlObj.stdID_Factor_DegreeAdmission);

            if (degree_admission == "1" || degree_admission == "2" || degree_admission == "3")
            {
                degree_char = "U";
            }
            else if (degree_admission == "4" || degree_admission == "5" || degree_admission == "6")
            {
                degree_char = "B";
            }
            else if (degree_admission == "7")
            {
                degree_char = "P";
            }
            else if (degree_admission == "8")
            {
                degree_char = "M";
            }
            else if (degree_admission == "9")
            {
                degree_char = "D";
            }

            studentData = new Student().getStudent(txtSTUDENT_ID.Text, degree_char);

            if (studentData.Student_ID != null)
            {
                //วิชาการคณะ
                if (autro_obj.CheckGroupUser(login_data, group_var.officer_faculty))
                {
                    bool          check = false;
                    List <string> faculty_authorized = autro_obj.getFaculty_Authorized(login_data, group_var.officer_faculty);

                    foreach (string fac in faculty_authorized)
                    {
                        if (fac == studentData.Faculty_Code)
                        {
                            check = true;
                            break;
                        }
                    }

                    if (check == true)
                    {
                        divShow.Visible = true;

                        txtSTD_FIRSTNAME.Text        = studentData.First_ThaiName;
                        txtSTD_SURNAME.Text          = studentData.Family_ThaiName;
                        txt_STD_FACULTY.Text         = new Faculty().getFaculty(studentData.Faculty_Code).Faculty_Thai;
                        txtSTD_DEPARTMENT.Text       = new Department().getDepartment(studentData.Department_Code).Department_Thai;
                        txtSTD_MAJOR.Text            = new Major().getMajor(studentData.Major_Code).Major_Thai;
                        txtSTD_SPEC_FIELD.Text       = new SpecialField().getSpecialField(studentData.Spec_Field_Code).SpecialField_Thai;
                        Session["save_student_data"] = studentData;

                        GradAdvisorData advisor_data = new Student().getAdvisorCoAdvisor(studentData.Student_ID);
                        lecturerData = new Lecturer().getGradLecturer();

                        if ((advisor_data.Advisor_ID != null) && (advisor_data.Advisor_ID != "") && (advisor_data.Advisor_ID != "0"))
                        {
                            // Advisor
                            ddlADVISOR.Items.Clear();
                            ddlADVISOR.Items.Insert(ddlADVISOR.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlADVISOR.Items.Insert(ddlADVISOR.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }

                            try
                            {
                                ddlADVISOR.Items.FindByValue(advisor_data.Advisor_ID).Selected = true;
                            }
                            catch
                            {
                                ddlADVISOR.SelectedIndex = 0;
                            }

                            btnSAVE.Enabled = false;
                            btnEdit.Enabled = true;
                        }
                        else
                        {
                            // Advisor
                            ddlADVISOR.Items.Clear();
                            ddlADVISOR.Items.Insert(ddlADVISOR.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlADVISOR.Items.Insert(ddlADVISOR.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }

                            btnSAVE.Enabled = true;
                            btnEdit.Enabled = false;
                        }

                        if ((advisor_data.CoAdvisor_ID1 != null) && (advisor_data.CoAdvisor_ID1 != "") && (advisor_data.CoAdvisor_ID1 != "0"))
                        {
                            //Co-Advisor1
                            ddlCO_ADVISOR_1.Items.Clear();
                            ddlCO_ADVISOR_1.Items.Insert(ddlCO_ADVISOR_1.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlCO_ADVISOR_1.Items.Insert(ddlCO_ADVISOR_1.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }

                            try
                            {
                                ddlCO_ADVISOR_1.Items.FindByValue(advisor_data.CoAdvisor_ID1).Selected = true;
                            }
                            catch
                            {
                                ddlCO_ADVISOR_1.SelectedIndex = 0;
                            }
                        }
                        else
                        {
                            //Co-Advisor1
                            ddlCO_ADVISOR_1.Items.Clear();
                            ddlCO_ADVISOR_1.Items.Insert(ddlCO_ADVISOR_1.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlCO_ADVISOR_1.Items.Insert(ddlCO_ADVISOR_1.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }
                        }

                        if ((advisor_data.CoAdvisor_ID2 != null) && (advisor_data.CoAdvisor_ID2 != "") && (advisor_data.CoAdvisor_ID2 != "0"))
                        {
                            //Co-Advisor2
                            ddlCO_ADVISOR_2.Items.Clear();
                            ddlCO_ADVISOR_2.Items.Insert(ddlCO_ADVISOR_2.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlCO_ADVISOR_2.Items.Insert(ddlCO_ADVISOR_2.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }

                            try
                            {
                                ddlCO_ADVISOR_2.Items.FindByValue(advisor_data.CoAdvisor_ID2).Selected = true;
                            }
                            catch
                            {
                                ddlCO_ADVISOR_2.SelectedIndex = 0;
                            }
                        }
                        else
                        {
                            //Co-Advisor2
                            ddlCO_ADVISOR_2.Items.Clear();
                            ddlCO_ADVISOR_2.Items.Insert(ddlCO_ADVISOR_2.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlCO_ADVISOR_2.Items.Insert(ddlCO_ADVISOR_2.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }
                        }

                        if ((advisor_data.CoAdvisor_ID3 != null) && (advisor_data.CoAdvisor_ID3 != "") && (advisor_data.CoAdvisor_ID3 != "0"))
                        {
                            //Co-Advisor3
                            ddlCO_ADVISOR_3.Items.Clear();
                            ddlCO_ADVISOR_3.Items.Insert(ddlCO_ADVISOR_3.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlCO_ADVISOR_3.Items.Insert(ddlCO_ADVISOR_3.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }

                            try
                            {
                                ddlCO_ADVISOR_3.Items.FindByValue(advisor_data.CoAdvisor_ID3).Selected = true;
                            }
                            catch
                            {
                                ddlCO_ADVISOR_3.SelectedIndex = 0;
                            }
                        }
                        else
                        {
                            //Co-Advisor3
                            ddlCO_ADVISOR_3.Items.Clear();
                            ddlCO_ADVISOR_3.Items.Insert(ddlCO_ADVISOR_3.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlCO_ADVISOR_3.Items.Insert(ddlCO_ADVISOR_3.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }
                        }

                        if ((advisor_data.CoAdvisor_ID4 != null) && (advisor_data.CoAdvisor_ID4 != "") && (advisor_data.CoAdvisor_ID4 != "0"))
                        {
                            //Co-Advisor4
                            ddlCO_ADVISOR_4.Items.Clear();
                            ddlCO_ADVISOR_4.Items.Insert(ddlCO_ADVISOR_4.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlCO_ADVISOR_4.Items.Insert(ddlCO_ADVISOR_4.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }

                            try
                            {
                                ddlCO_ADVISOR_4.Items.FindByValue(advisor_data.CoAdvisor_ID4).Selected = true;
                            }
                            catch
                            {
                                ddlCO_ADVISOR_4.SelectedIndex = 0;
                            }
                        }
                        else
                        {
                            //Co-Advisor4
                            ddlCO_ADVISOR_4.Items.Clear();
                            ddlCO_ADVISOR_4.Items.Insert(ddlCO_ADVISOR_4.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlCO_ADVISOR_4.Items.Insert(ddlCO_ADVISOR_4.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }
                        }

                        if ((advisor_data.CoAdvisor_ID5 != null) && (advisor_data.CoAdvisor_ID5 != "") && (advisor_data.CoAdvisor_ID5 != "0"))
                        {
                            //Co-Advisor5
                            ddlCO_ADVISOR_5.Items.Clear();
                            ddlCO_ADVISOR_5.Items.Insert(ddlCO_ADVISOR_5.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlCO_ADVISOR_5.Items.Insert(ddlCO_ADVISOR_5.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }

                            try
                            {
                                ddlCO_ADVISOR_5.Items.FindByValue(advisor_data.CoAdvisor_ID5).Selected = true;
                            }
                            catch
                            {
                                ddlCO_ADVISOR_5.SelectedIndex = 0;
                            }
                        }
                        else
                        {
                            //Co-Advisor5
                            ddlCO_ADVISOR_5.Items.Clear();
                            ddlCO_ADVISOR_5.Items.Insert(ddlCO_ADVISOR_5.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlCO_ADVISOR_5.Items.Insert(ddlCO_ADVISOR_5.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }
                        }
                    }
                    else
                    {
                        divShow.Visible = false;
                        MsgValidate("ไม่สามารถเข้าถึงนักศึกษาคณะอื่นได้");
                    }
                }
                //วิชาการภาค
                else if (autro_obj.CheckGroupUser(login_data, group_var.officer_department))
                {
                    bool          check = false;
                    List <string> department_authorized = autro_obj.getDepartment_Authorized(login_data, group_var.officer_department);

                    foreach (string dep in department_authorized)
                    {
                        if (dep == studentData.Department_Code)
                        {
                            check = true;
                            break;
                        }
                    }

                    if (check == true)
                    {
                        divShow.Visible = true;

                        txtSTD_FIRSTNAME.Text        = studentData.First_ThaiName;
                        txtSTD_SURNAME.Text          = studentData.Family_ThaiName;
                        txt_STD_FACULTY.Text         = new Faculty().getFaculty(studentData.Faculty_Code).Faculty_Thai;
                        txtSTD_DEPARTMENT.Text       = new Department().getDepartment(studentData.Department_Code).Department_Thai;
                        txtSTD_MAJOR.Text            = new Major().getMajor(studentData.Major_Code).Major_Thai;
                        txtSTD_SPEC_FIELD.Text       = new SpecialField().getSpecialField(studentData.Spec_Field_Code).SpecialField_Thai;
                        Session["save_student_data"] = studentData;

                        GradAdvisorData advisor_data = new Student().getAdvisorCoAdvisor(studentData.Student_ID);
                        lecturerData = new Lecturer().getGradLecturer();

                        if ((advisor_data.Advisor_ID != null) && (advisor_data.Advisor_ID != "") && (advisor_data.Advisor_ID != "0"))
                        {
                            // Advisor
                            ddlADVISOR.Items.Clear();
                            ddlADVISOR.Items.Insert(ddlADVISOR.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlADVISOR.Items.Insert(ddlADVISOR.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }

                            try
                            {
                                ddlADVISOR.Items.FindByValue(advisor_data.Advisor_ID).Selected = true;
                            }
                            catch
                            {
                                ddlADVISOR.SelectedIndex = 0;
                            }

                            btnSAVE.Enabled = false;
                            btnEdit.Enabled = true;
                        }
                        else
                        {
                            // Advisor
                            ddlADVISOR.Items.Clear();
                            ddlADVISOR.Items.Insert(ddlADVISOR.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlADVISOR.Items.Insert(ddlADVISOR.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }

                            btnSAVE.Enabled = true;
                            btnEdit.Enabled = false;
                        }

                        if ((advisor_data.CoAdvisor_ID1 != null) && (advisor_data.CoAdvisor_ID1 != "") && (advisor_data.CoAdvisor_ID1 != "0"))
                        {
                            //Co-Advisor1
                            ddlCO_ADVISOR_1.Items.Clear();
                            ddlCO_ADVISOR_1.Items.Insert(ddlCO_ADVISOR_1.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlCO_ADVISOR_1.Items.Insert(ddlCO_ADVISOR_1.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }

                            try
                            {
                                ddlCO_ADVISOR_1.Items.FindByValue(advisor_data.CoAdvisor_ID1).Selected = true;
                            }
                            catch
                            {
                                ddlCO_ADVISOR_1.SelectedIndex = 0;
                            }
                        }
                        else
                        {
                            //Co-Advisor1
                            ddlCO_ADVISOR_1.Items.Clear();
                            ddlCO_ADVISOR_1.Items.Insert(ddlCO_ADVISOR_1.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlCO_ADVISOR_1.Items.Insert(ddlCO_ADVISOR_1.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }
                        }

                        if ((advisor_data.CoAdvisor_ID2 != null) && (advisor_data.CoAdvisor_ID2 != "") && (advisor_data.CoAdvisor_ID2 != "0"))
                        {
                            //Co-Advisor2
                            ddlCO_ADVISOR_2.Items.Clear();
                            ddlCO_ADVISOR_2.Items.Insert(ddlCO_ADVISOR_2.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlCO_ADVISOR_2.Items.Insert(ddlCO_ADVISOR_2.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }

                            try
                            {
                                ddlCO_ADVISOR_2.Items.FindByValue(advisor_data.CoAdvisor_ID2).Selected = true;
                            }
                            catch
                            {
                                ddlCO_ADVISOR_2.SelectedIndex = 0;
                            }
                        }
                        else
                        {
                            //Co-Advisor2
                            ddlCO_ADVISOR_2.Items.Clear();
                            ddlCO_ADVISOR_2.Items.Insert(ddlCO_ADVISOR_2.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlCO_ADVISOR_2.Items.Insert(ddlCO_ADVISOR_2.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }
                        }

                        if ((advisor_data.CoAdvisor_ID3 != null) && (advisor_data.CoAdvisor_ID3 != "") && (advisor_data.CoAdvisor_ID3 != "0"))
                        {
                            //Co-Advisor3
                            ddlCO_ADVISOR_3.Items.Clear();
                            ddlCO_ADVISOR_3.Items.Insert(ddlCO_ADVISOR_3.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlCO_ADVISOR_3.Items.Insert(ddlCO_ADVISOR_3.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }

                            try
                            {
                                ddlCO_ADVISOR_3.Items.FindByValue(advisor_data.CoAdvisor_ID3).Selected = true;
                            }
                            catch
                            {
                                ddlCO_ADVISOR_3.SelectedIndex = 0;
                            }
                        }
                        else
                        {
                            //Co-Advisor3
                            ddlCO_ADVISOR_3.Items.Clear();
                            ddlCO_ADVISOR_3.Items.Insert(ddlCO_ADVISOR_3.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlCO_ADVISOR_3.Items.Insert(ddlCO_ADVISOR_3.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }
                        }

                        if ((advisor_data.CoAdvisor_ID4 != null) && (advisor_data.CoAdvisor_ID4 != "") && (advisor_data.CoAdvisor_ID4 != "0"))
                        {
                            //Co-Advisor4
                            ddlCO_ADVISOR_4.Items.Clear();
                            ddlCO_ADVISOR_4.Items.Insert(ddlCO_ADVISOR_4.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlCO_ADVISOR_4.Items.Insert(ddlCO_ADVISOR_4.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }

                            try
                            {
                                ddlCO_ADVISOR_4.Items.FindByValue(advisor_data.CoAdvisor_ID4).Selected = true;
                            }
                            catch
                            {
                                ddlCO_ADVISOR_4.SelectedIndex = 0;
                            }
                        }
                        else
                        {
                            //Co-Advisor4
                            ddlCO_ADVISOR_4.Items.Clear();
                            ddlCO_ADVISOR_4.Items.Insert(ddlCO_ADVISOR_4.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlCO_ADVISOR_4.Items.Insert(ddlCO_ADVISOR_4.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }
                        }

                        if ((advisor_data.CoAdvisor_ID5 != null) && (advisor_data.CoAdvisor_ID5 != "") && (advisor_data.CoAdvisor_ID5 != "0"))
                        {
                            //Co-Advisor5
                            ddlCO_ADVISOR_5.Items.Clear();
                            ddlCO_ADVISOR_5.Items.Insert(ddlCO_ADVISOR_5.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlCO_ADVISOR_5.Items.Insert(ddlCO_ADVISOR_5.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }

                            try
                            {
                                ddlCO_ADVISOR_5.Items.FindByValue(advisor_data.CoAdvisor_ID5).Selected = true;
                            }
                            catch
                            {
                                ddlCO_ADVISOR_5.SelectedIndex = 0;
                            }
                        }
                        else
                        {
                            //Co-Advisor5
                            ddlCO_ADVISOR_5.Items.Clear();
                            ddlCO_ADVISOR_5.Items.Insert(ddlCO_ADVISOR_5.Items.Count, new ListItem("--- เลือกอาจารย์ ---", "0"));
                            foreach (LectuereInformationData data in lecturerData)
                            {
                                ddlCO_ADVISOR_5.Items.Insert(ddlCO_ADVISOR_5.Items.Count, new ListItem(data.Lecturer_ShortName + " " + data.First_ThaiName + " " + data.Family_ThaiName, data.Lecturer_ID));
                            }
                        }
                    }
                    else
                    {
                        divShow.Visible = false;
                        MsgValidate("ไม่สามารถเข้าถึงนักศึกษาภาควิชาอื่นได้");
                    }
                }
            }
            else
            {
                divShow.Visible = false;
                MsgValidate("ตรวจสอบไม่พบ นักศึกษาที่ค้นหา");
            }
        }
    }
    protected void btnSEARCH_Click(object sender, EventArgs e)
    {
        utility utlObj = new utility();
        UInt64  chknum;

        txtSTD_FIRSTNAME.Text  = "";
        txtSTD_SURNAME.Text    = "";
        txt_STD_FACULTY.Text   = "";
        txtSTD_DEPARTMENT.Text = "";
        txtSTD_MAJOR.Text      = "";
        txtSTD_SPEC_FIELD.Text = "";

        btnSAVE.Enabled      = false;
        btnEdit.Enabled      = false;
        divFail.Visible      = false;
        divDupRegis.Visible  = false;
        divDupExtend.Visible = false;

        Session.Remove("save_student_data");

        if (txtSTUDENT_ID.Text.Length != 13)
        {
            //divShow.Visible = false;
            MsgValidate("กรุณาระบุ รหัสนักศึกษาด้วยตัวเลข 13 หลัก");
        }
        else if (!UInt64.TryParse(txtSTUDENT_ID.Text, out chknum))
        {
            MsgValidate("กรุณาระบุ รหัสนักศึกษาด้วยตัวเลขเท่านั้น");
        }
        else
        {
            divFail.Visible = false;

            extend_data        = (LecturerTableData)Session["Extend_Data"];
            course_degree_char = extend_data.Course_Degree_Char;
            string degree_admission = utlObj.getFactorFromStudentID(txtSTUDENT_ID.Text, utlObj.stdID_Factor_DegreeAdmission);

            if (degree_admission == "1" || degree_admission == "2" || degree_admission == "3")
            {
                degree_char = "U";
            }
            else if (degree_admission == "4" || degree_admission == "5" || degree_admission == "6")
            {
                degree_char = "B";
            }
            else if (degree_admission == "7")
            {
                degree_char = "P";
            }
            else if (degree_admission == "8")
            {
                degree_char = "M";
            }
            else if (degree_admission == "9")
            {
                degree_char = "D";
            }

            studentData = new Student().getStudent(txtSTUDENT_ID.Text, degree_char);

            if (studentData.Student_ID != null)
            {
                RegistrationData regisData = new RegistrationData();
                regisData = new Student_Registration().getDupRegistration(extend_data.AcademicYear, extend_data.Semester, extend_data.Course_Code, studentData.Student_ID, degree_char);

                List <ExtendAvailableStudentData> dupextendData = new List <ExtendAvailableStudentData>();
                dupextendData = new ExtendAvailableStudent().getExtendStudent(extend_data.AcademicYear, extend_data.Semester, extend_data.Course_Code, extend_data.Course_Type, studentData.Student_ID);

                //divShow.Visible = true;
                CourseData course_data = new CourseData();
                course_data = new Course().getCourse(extend_data.Course_Code);

                string course_type = "";
                string course_sec  = "";

                if (extend_data.Course_Type == "1")
                {
                    course_type = "S.";
                }
                else if (extend_data.Course_Type == "2")
                {
                    course_type = "L.";
                }
                else if (extend_data.Course_Type == "4")
                {
                    course_type = "T.";
                }
                else if (extend_data.Course_Type == "5")
                {
                    course_type = "M.";
                }
                else if (extend_data.Course_Type == "6")
                {
                    course_type = "SP.";
                }
                else if (extend_data.Course_Type == "7")
                {
                    course_type = "D.";
                }

                if (extend_data.SubSec_No != 0)
                {
                    course_sec = extend_data.SubSec_No.ToString();
                }
                else
                {
                    course_sec = extend_data.Sec_No.ToString();
                }



                lblHead.Text = course_type + course_sec + " " + extend_data.Course_Code + " " + course_data.Course_Thainame + "( " + course_data.Course_Engname + " )";

                txtSTD_FIRSTNAME.Text  = studentData.First_ThaiName;
                txtSTD_SURNAME.Text    = studentData.Family_ThaiName;
                txt_STD_FACULTY.Text   = new Faculty().getFaculty(studentData.Faculty_Code).Faculty_Thai;
                txtSTD_DEPARTMENT.Text = new Department().getDepartment(studentData.Department_Code).Department_Thai;
                txtSTD_MAJOR.Text      = new Major().getMajor(studentData.Major_Code).Major_Thai;
                txtSTD_SPEC_FIELD.Text = new SpecialField().getSpecialField(studentData.Spec_Field_Code).SpecialField_Thai;

                if (regisData.Course_Code != null)
                {
                    divDupRegis.Visible = true;

                    string course_type1 = "";
                    course_data = new Course().getCourse(regisData.Course_Code);
                    List <TeachingTableData> teachingData = new List <TeachingTableData>();
                    teachingData = new TeachingTable().getSubTeachingTable(regisData.Academic_Year, regisData.Semester, regisData.Course_Code, regisData.Sec_No, regisData.SubSec_No, degree_char);

                    if (extend_data.Course_Type == "1")
                    {
                        course_type1 = "S.";
                    }
                    else if (extend_data.Course_Type == "2")
                    {
                        course_type1 = "L.";
                    }
                    else if (extend_data.Course_Type == "4")
                    {
                        course_type1 = "T.";
                    }
                    else if (extend_data.Course_Type == "5")
                    {
                        course_type1 = "M.";
                    }
                    else if (extend_data.Course_Type == "6")
                    {
                        course_type1 = "SP.";
                    }
                    else if (extend_data.Course_Type == "7")
                    {
                        course_type1 = "D.";
                    }


                    lblErr2.Text  = "";
                    lblErr2.Text += "<div class='row'>";
                    lblErr2.Text += "<article class='col-sm-12 col-md-12 col-lg-12'>";
                    lblErr2.Text += "<div class='jarviswidget jarviswidget-color-primary' id='" + regisData.Course_Code + "' data-widget-editbutton='false' data-widget-deletebutton='false' data-widget-fullscreenbutton='false' data-widget-sortable='false'>";
                    lblErr2.Text += "<header><span class='widget-icon'><i class='fa fa-table'></i></span><h2>ข้อมูลการลงทะเบียน</h2></header>";
                    lblErr2.Text += "<div><div class='widget-body no-padding'><div class='widget-body-toolbar'></div>";
                    lblErr2.Text += "<table class='table table-bordered table-striped table-hover smart-form'>";
                    lblErr2.Text += "<thead><tr><th class='text-center' style='width:50px'>ตอนที่</th><th class='text-center' style='width:50px'>วิชา</th><th class='text-center' style='width:50px'>ห้องเรียน</th><th class='text-center' style='width:50px'>เวลาเรียน</th><th class='text-center' style='width:50px'>ผู้สอน</th></tr></thead>";
                    lblErr2.Text += "<tbody>";
                    lblErr2.Text += "<tr>";
                    if (regisData.SubSec_No != 0)
                    {
                        lblErr2.Text += "<td class='text-center'>" + course_type1 + regisData.SubSec_No + "</td>";
                    }
                    else
                    {
                        lblErr2.Text += "<td class='text-center'>" + course_type1 + regisData.Sec_No + "</td>";
                    }
                    lblErr2.Text += "<td class='text-left'>" + regisData.Course_Code + " " + course_data.Course_Thainame + "</td>";

                    string room = "";
                    foreach (TeachingTableData teach in teachingData)
                    {
                        room += teach.Building_Code + "-" + teach.Room_Code;
                        if (teach.Campus_Code == "2")
                        {
                            room += "*";
                        }
                        else if (teach.Campus_Code == "3")
                        {
                            room += "**";
                        }

                        room += "<br/>";
                    }
                    lblErr2.Text += "<td class='text-center'>" + room + "</td>";

                    string teachtime = "";
                    foreach (TeachingTableData teach in teachingData)
                    {
                        string day = "";

                        if (teach.Teaching_Day == "1")
                        {
                            day = "Mon";
                        }
                        else if (teach.Teaching_Day == "2")
                        {
                            day = "Tue";
                        }
                        if (teach.Teaching_Day == "3")
                        {
                            day = "Wed";
                        }
                        if (teach.Teaching_Day == "4")
                        {
                            day = "Thu";
                        }
                        if (teach.Teaching_Day == "5")
                        {
                            day = "Fri";
                        }
                        if (teach.Teaching_Day == "6")
                        {
                            day = "Sat";
                        }
                        if (teach.Teaching_Day == "7")
                        {
                            day = "Sun";
                        }

                        teachtime += day + " " + teach.Teaching_Start_Time + " - " + teach.Teaching_End_Time + "<br>";
                    }
                    lblErr2.Text += "<td class='text-center'>" + teachtime + "</td>";

                    string lec_name = "";
                    List <LecturerTableData> lecturerData = new List <LecturerTableData>();
                    foreach (TeachingTableData teach in teachingData)
                    {
                        lecturerData = new LecturerTable().getLecturerTable(teach, degree_char);
                        foreach (LecturerTableData lec in lecturerData)
                        {
                            lec_name += new Lecturer().getLecturer(lec.Lecturer).Lecturer_ShortName + ",";
                        }

                        lec_name = lec_name.Substring(0, lec_name.Length - 1);

                        lec_name += "<br>";
                    }
                    lblErr2.Text += "<td class='text-center'>" + lec_name + "</td>";

                    lblErr2.Text += "</tr>";
                    lblErr2.Text += "</tbody>";
                    lblErr2.Text += "</table></div></div></div></article></div>";
                }
                else if (dupextendData.Count != 0)
                {
                    divDupExtend.Visible = true;

                    lblErr3.Text  = "";
                    lblErr3.Text += "<div class='row'>";
                    lblErr3.Text += "<article class='col-sm-12 col-md-12 col-lg-12'>";
                    lblErr3.Text += "<div class='jarviswidget jarviswidget-color-primary' id='" + regisData.Course_Code + "' data-widget-editbutton='false' data-widget-deletebutton='false' data-widget-fullscreenbutton='false' data-widget-sortable='false'>";
                    lblErr3.Text += "<header><span class='widget-icon'><i class='fa fa-table'></i></span><h2>ข้อมูลการลงทะเบียน</h2></header>";
                    lblErr3.Text += "<div><div class='widget-body no-padding'><div class='widget-body-toolbar'></div>";
                    lblErr3.Text += "<table class='table table-bordered table-striped table-hover smart-form'>";
                    lblErr3.Text += "<thead><tr><th class='text-center' style='width:50px'>ตอนที่</th><th class='text-center' style='width:50px'>วิชา</th><th class='text-center' style='width:50px'>ห้องเรียน</th><th class='text-center' style='width:50px'>เวลาเรียน</th><th class='text-center' style='width:50px'>ผู้สอน</th></tr></thead>";

                    foreach (ExtendAvailableStudentData data in dupextendData)
                    {
                        string course_type1 = "";
                        course_data = new Course().getCourse(data.Course_Code);
                        List <TeachingTableData> teachingData = new List <TeachingTableData>();
                        teachingData = new TeachingTable().getSubTeachingTable(data.AcademicYear, data.Semester, data.Course_Code, data.Sec_No, data.SubSec_No, course_degree_char);

                        if (data.Course_Type == "1")
                        {
                            course_type1 = "S.";
                        }
                        else if (data.Course_Type == "2")
                        {
                            course_type1 = "L.";
                        }
                        else if (data.Course_Type == "4")
                        {
                            course_type1 = "T.";
                        }
                        else if (data.Course_Type == "5")
                        {
                            course_type1 = "M.";
                        }
                        else if (data.Course_Type == "6")
                        {
                            course_type1 = "SP.";
                        }
                        else if (data.Course_Type == "7")
                        {
                            course_type1 = "D.";
                        }


                        lblErr3.Text += "<tbody>";
                        lblErr3.Text += "<tr>";

                        if (data.SubSec_No != 0)
                        {
                            lblErr3.Text += "<td class='text-center'>" + course_type1 + data.SubSec_No + "</td>";
                        }
                        else
                        {
                            lblErr3.Text += "<td class='text-center'>" + course_type1 + data.Sec_No + "</td>";
                        }

                        lblErr3.Text += "<td class='text-left'>" + data.Course_Code + " " + course_data.Course_Thainame + "</td>";

                        string room = "";
                        foreach (TeachingTableData teach in teachingData)
                        {
                            room += teach.Building_Code + "-" + teach.Room_Code;
                            if (teach.Campus_Code == "2")
                            {
                                room += "*";
                            }
                            else if (teach.Campus_Code == "3")
                            {
                                room += "**";
                            }

                            room += "<br/>";
                        }

                        lblErr3.Text += "<td class='text-center'>" + room + "</td>";

                        string teachtime = "";
                        foreach (TeachingTableData teach in teachingData)
                        {
                            string day = "";

                            if (teach.Teaching_Day == "1")
                            {
                                day = "Mon";
                            }
                            else if (teach.Teaching_Day == "2")
                            {
                                day = "Tue";
                            }
                            if (teach.Teaching_Day == "3")
                            {
                                day = "Wed";
                            }
                            if (teach.Teaching_Day == "4")
                            {
                                day = "Thu";
                            }
                            if (teach.Teaching_Day == "5")
                            {
                                day = "Fri";
                            }
                            if (teach.Teaching_Day == "6")
                            {
                                day = "Sat";
                            }
                            if (teach.Teaching_Day == "7")
                            {
                                day = "Sun";
                            }

                            teachtime += day + " " + teach.Teaching_Start_Time + " - " + teach.Teaching_End_Time + "<br>";
                        }

                        lblErr3.Text += "<td class='text-center'>" + teachtime + "</td>";

                        string lec_name = "";
                        List <LecturerTableData> lecturerData = new List <LecturerTableData>();
                        foreach (TeachingTableData teach in teachingData)
                        {
                            lecturerData = new LecturerTable().getLecturerTable(teach, course_degree_char);
                            foreach (LecturerTableData lec in lecturerData)
                            {
                                lec_name += new Lecturer().getLecturer(lec.Lecturer).Lecturer_ShortName + ",";
                            }

                            lec_name = lec_name.Substring(0, lec_name.Length - 1);

                            lec_name += "<br>";
                        }

                        lblErr3.Text += "<td class='text-center'>" + lec_name + "</td>";

                        lblErr3.Text += "</tr>";
                        lblErr3.Text += "</tbody>";
                    }

                    lblErr3.Text += "</table></div></div></div></article></div>";
                }
                else
                {
                    divFail.Visible              = false;
                    divDupRegis.Visible          = false;
                    btnSAVE.Enabled              = true;
                    Session["save_student_data"] = studentData;
                }
            }
            else
            {
                // divShow.Visible = false;
                MsgValidate("ตรวจสอบไม่พบ นักศึกษาที่ค้นหา");
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["login_data"] == null)
        {
            Response.Redirect("../index.aspx");
        }
        else
        {
            //ตรวจสอบสิทธิ์
            login_data = (UserLoginData)Session["login_data"];
            if (autro_obj.CheckGroupUser(login_data, group_var.lecturer))
            {
                // ======== Process ===========
                config_data   = new SystemConfig().getConfig();
                academic_year = config_data.AcademicYear;
                semester      = config_data.Semester;

                row1 = Request.QueryString["show_row"];


                if (Session["showCourse" + row1] == null)
                {
                    Response.Redirect("List_Course_Lecturer.aspx");
                }
                else
                {
                    LecturerTableData lectuere_data = new LecturerTableData();

                    lnkADD.NavigateUrl = "Extend_Student.aspx?show_row=" + row1;

                    lectuere_data = (LecturerTableData)Session["showCourse" + row1];

                    Session["Extend_Data"] = lectuere_data;

                    lec_info    = new Lecturer().getLecturer(lectuere_data.Lecturer);
                    course_info = new Course().getCourse(lectuere_data.Course_Code);


                    string course_type = "";
                    string course_sec  = "";

                    if (lectuere_data.Course_Type == "1")
                    {
                        course_type = "S.";
                    }
                    else if (lectuere_data.Course_Type == "2")
                    {
                        course_type = "L.";
                    }
                    else if (lectuere_data.Course_Type == "4")
                    {
                        course_type = "T.";
                    }
                    else if (lectuere_data.Course_Type == "5")
                    {
                        course_type = "M.";
                    }
                    else if (lectuere_data.Course_Type == "6")
                    {
                        course_type = "SP.";
                    }
                    else if (lectuere_data.Course_Type == "7")
                    {
                        course_type = "D.";
                    }

                    if (lectuere_data.SubSec_No != 0)
                    {
                        course_sec = lectuere_data.SubSec_No.ToString();
                    }
                    else
                    {
                        course_sec = lectuere_data.Sec_No.ToString();
                    }

                    lblLec.Text = lec_info.Lecturer_ShortName + " " + lec_info.First_ThaiName + " " + lec_info.Family_ThaiName;

                    lblHeader.Text = course_type + course_sec + " " + course_info.Course_Code + " " + course_info.Course_Thainame + " " + course_info.Course_Engname;

                    if (!Page.IsPostBack)
                    {
                        // Session.Remove("ApproveRegis");
                    }

                    try
                    {
                        List <RegistrationData> temp1 = new Student_Registration().getStudentRegistration(academic_year, semester, lectuere_data.Course_Code, lectuere_data.Sec_No, lectuere_data.SubSec_No);
                        // List<RegistrationData> temp2 = new Student_Registration().getStudentRegistration(academic_year, semester, lectuere_data.Course_Code, lectuere_data.Sec_No, lectuere_data.SubSec_No, "M");

                        foreach (RegistrationData reg in temp1)
                        {
                            studentRegisData.Add(reg);
                        }

                        //foreach (RegistrationData reg in temp2)
                        //{
                        //    studentRegisData.Add(reg);
                        //}

                        studentExtendData = new ExtendAvailableStudent().getExtendStudent(academic_year, semester, lectuere_data.Course_Code, lectuere_data.Sec_No, lectuere_data.SubSec_No);

                        int numrow  = 1;
                        int numrow2 = 1;

                        string[] ar  = { "ลำดับที่", "รหัสนักศึกษา", "ชื่อ-นามสกุล", "คณะ", "หลักสูตร", "ประเภท", "รอบ", "ห้อง", "อาจารย์ที่ปรึกษา อนุมัติ" };
                        string[] ar2 = { "ลำดับที่", "รหัสนักศึกษา", "ชื่อ-นามสกุล", "คณะ", "หลักสูตร", "ประเภท", "รอบ", "ห้อง", "อาจารย์ผู้ดำเนินการ", "ยกเลิก" };
                        Table    tb1 = new Table();
                        Table    tb2 = new Table();

                        tb1.Attributes.Add("class", "table table-bordered table-hover table-striped");
                        tb1.Attributes.Add("id", "dt_basic");
                        tb2.Attributes.Add("class", "table table-bordered table-hover table-striped");
                        tb2.Attributes.Add("id", "dt_basic");

                        TableHeaderRow tRowHead = new TableHeaderRow();
                        tRowHead.TableSection = TableRowSection.TableHeader;
                        TableHeaderRow tRowHead2 = new TableHeaderRow();
                        tRowHead2.TableSection = TableRowSection.TableHeader;

                        for (int cellCtr = 1; cellCtr <= ar.Length; cellCtr++)
                        {
                            // Create a new cell and add it to the row.
                            TableHeaderCell cellHead = new TableHeaderCell();
                            cellHead.Text = ar[cellCtr - 1];
                            cellHead.Attributes.Add("class", "text-align-center");
                            tRowHead.Cells.Add(cellHead);
                        }
                        tb1.Rows.Add(tRowHead);

                        for (int cellCtr = 1; cellCtr <= ar2.Length; cellCtr++)
                        {
                            // Create a new cell and add it to the row.
                            TableHeaderCell cellHead = new TableHeaderCell();
                            cellHead.Text = ar2[cellCtr - 1];
                            cellHead.Attributes.Add("class", "text-align-center");
                            tRowHead2.Cells.Add(cellHead);
                        }
                        tb2.Rows.Add(tRowHead2);


                        foreach (RegistrationData data in studentRegisData)
                        {
                            TableRow tRowBody = new TableRow();
                            tRowBody.TableSection = TableRowSection.TableBody;

                            TableCell cellNum = new TableCell();
                            cellNum.Text = numrow.ToString();
                            cellNum.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellNum);

                            TableCell cellStudent_ID = new TableCell();
                            cellStudent_ID.Text = data.Student_ID;
                            cellStudent_ID.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellStudent_ID);

                            TableCell cellStudent_Name = new TableCell();
                            cellStudent_Name.Text = data.First_Thainame + " " + data.Family_Thainame;
                            cellStudent_Name.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellStudent_Name);

                            TableCell cellFaculty = new TableCell();
                            cellFaculty.Text = new Faculty().getFaculty(data.Faculty_Code).Faculty_Thai;
                            cellFaculty.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellFaculty);

                            TableCell cellCurri = new TableCell();
                            cellCurri.Text = data.Curr_Code.Substring(4) + " " + new Curriculum().getCurriculum(data.Curr_Code).Curr_ThaiName;
                            //cellCurri.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellCurri);

                            Student student_data = new Student();
                            student_data = new Student().getStudent(data.Student_ID, new Curriculum().getCurriculum(data.Curr_Code).Degree_Char);

                            TableCell cellCategory = new TableCell();
                            cellCategory.Text = student_data.StdCategoryThai;
                            cellCategory.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellCategory);

                            TableCell cellSection = new TableCell();
                            cellSection.Text = student_data.SectionThai;
                            cellSection.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellSection);

                            TableCell cellGroup = new TableCell();
                            cellGroup.Text = student_data.StdGroupName;
                            cellGroup.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellGroup);

                            TableCell cellApprove = new TableCell();
                            if (data.Approve_Status == "y")
                            {
                                cellApprove.Text = "อนุมัติ";
                                cellApprove.Attributes.Add("class", "txt-green-bold text-align-center");
                            }
                            else
                            {
                                cellApprove.Text = "รออนุมัติ";
                                cellApprove.Attributes.Add("class", "txt-red text-align-center");
                            }


                            tRowBody.Cells.Add(cellApprove);

                            tb1.Rows.Add(tRowBody);

                            numrow++;
                        }


                        TableRow  row  = new TableRow();
                        TableCell cell = new TableCell();
                        cell.Controls.Add(tb1);
                        row.Cells.Add(cell);
                        tblStudentAdvisor.Rows.Add(row);


                        foreach (ExtendAvailableStudentData data in studentExtendData)
                        {
                            Student student_data = new Student();
                            student_data = new Student().getStudent(data.Student_ID, new DegreeAdmission().getDegreeAdmissionChar(utlObj.getFactorFromStudentID(data.Student_ID, utlObj.stdID_Factor_DegreeAdmission)));

                            TableRow tRowBody = new TableRow();
                            tRowBody.TableSection = TableRowSection.TableBody;

                            TableCell cellNum = new TableCell();
                            cellNum.Text = numrow2.ToString();
                            cellNum.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellNum);

                            TableCell cellStudent_ID = new TableCell();
                            cellStudent_ID.Text = data.Student_ID;
                            cellStudent_ID.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellStudent_ID);

                            TableCell cellStudent_Name = new TableCell();
                            cellStudent_Name.Text = student_data.First_ThaiName + " " + student_data.Family_ThaiName;
                            cellStudent_Name.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellStudent_Name);

                            TableCell cellFaculty = new TableCell();
                            cellFaculty.Text = student_data.FacultyThai;
                            cellFaculty.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellFaculty);

                            TableCell cellCurri = new TableCell();
                            cellCurri.Text = student_data.Curri_Code.Substring(4) + " " + student_data.CurrThai;
                            //cellCurri.Text = "-";
                            tRowBody.Cells.Add(cellCurri);

                            TableCell cellCategory = new TableCell();
                            cellCategory.Text = student_data.StdCategoryThai;
                            cellCategory.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellCategory);

                            TableCell cellSection = new TableCell();
                            cellSection.Text = student_data.SectionThai;
                            cellSection.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellSection);

                            TableCell cellGroup = new TableCell();
                            cellGroup.Text = student_data.StdGroupName;
                            cellGroup.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellGroup);

                            TableCell cellLecturerAdd = new TableCell();
                            cellLecturerAdd.Text = new Lecturer().getLecturer(data.LECTURER_ADD).Lecturer_ShortName;
                            cellLecturerAdd.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellLecturerAdd);

                            TableCell cellApprove = new TableCell();
                            cellApprove.Text = "<a href='Cancel_Extend_Student.aspx?student_id=" + data.Student_ID + "&academic_year=" + data.AcademicYear + "&semester=" + data.Semester + "&course_code=" + data.Course_Code + "&sec=" + data.Sec_No + "&subsec=" + data.SubSec_No + "&lecturer_code=" + lectuere_data.Lecturer + "&show_row=" + row1 + "' title='Cancel' data-target='#deleteModal' data-toggle='modal'><h4><i class='fa fa-trash-o'></i></h4></a>";
                            cellApprove.Attributes.Add("class", "text-align-center");
                            tRowBody.Cells.Add(cellApprove);

                            tb2.Rows.Add(tRowBody);

                            numrow2++;
                        }

                        TableRow  row2  = new TableRow();
                        TableCell cell2 = new TableCell();
                        cell2.Controls.Add(tb2);
                        row2.Cells.Add(cell2);
                        tblExtendStudentAdvisor.Rows.Add(row2);
                    }
                    catch (Exception err)
                    {
                        HttpContext.Current.Session["response"] = "ไม่สามารถดำเนินการได้";
                        HttpContext.Current.Response.Redirect("err_response.aspx");
                    }
                }
                //=============================
            }
            else
            {
                HttpContext.Current.Session["response"] = "ตรวจสอบไม่พบสิทธิ์การเข้าใช้งาน";
                HttpContext.Current.Response.Redirect("err_response.aspx");
            }
        }
    }