예제 #1
0
파일: frmMain.cs 프로젝트: linhtnl/PRN_PE
 private void LoadData()
 {
     Students       = db.GetStudentList();
     dgv.DataSource = Students;
     //clear
     txtID.DataBindings.Clear();
     txtName.DataBindings.Clear();
     txtAge.DataBindings.Clear();
     //txtEmail.DataBindings.Clear();
     //set value
     txtID.DataBindings.Add("Text", Students, "StudentID");
     txtName.DataBindings.Add("Text", Students, "StudentName");
     txtAge.DataBindings.Add("Text", Students, "Age");
     // txtEmail.DataBindings.Add("Text", Students, "Email");
     txtID.Enabled = false;
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            //only run once(when load the first time
            if (!Page.IsPostBack)
            {
                List <Projects> projectList = new List <Projects>();
                projectList = ProjectDB.SearchAllProject();
                foreach (Projects project in projectList)
                {
                    DropDownListProjets.Items.Add(project.ProjectCode);
                }

                List <Students> studentList = new List <Students>();
                studentList = StudentDB.GetStudentList();
                foreach (Students student in studentList)
                {
                    DropDownListStudents.Items.Add(student.StudentNumber.ToString());
                }
            }
        }