protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Course.DataSource = CoursesDataSource; Course.DataTextField = "CourseName"; Course.DataValueField = "CourseId"; Course.DataBind(); Batch.DataSource = BatchesDataSource; Batch.DataTextField = "BatchName"; Batch.DataValueField = "BatchId"; Batch.DataBind(); Section.DataSource = SectionsDataSource; Section.DataTextField = "SectionName"; Section.DataValueField = "SectionId"; Section.DataBind(); Teacher.DataSource = TeachersDataSource; Teacher.DataValueField = "TeacherId"; Teacher.DataTextField = "TeacherName"; Teacher.DataBind(); Department.DataSource = DepartmentsDataSource; Department.DataValueField = "DepartmentId"; Department.DataTextField = "DepartmentName"; Department.DataBind(); Semester.DataSource = SemestersDataSource; Semester.DataValueField = "SemesterId"; Semester.DataTextField = "SemesterName"; Semester.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { AuthHelper.LoginCheck(Session, Request, Response, Server); if (!IsPostBack) { var all = new ClassServiceImpl().GetAll(); DropDownList1.DataSource = all; //绑定班级 DropDownList1.DataTextField = "Name"; DropDownList1.DataValueField = "ClassId"; DropDownList1.DataBind(); ArrayList schoolYear = new ArrayList(); //绑定学年 for (int i = DateTime.Now.Year; i >= DateTime.Now.Year - 6; i--) { schoolYear.Add((i) + "-" + (i + 1)); } SchoolYear.DataSource = schoolYear; SchoolYear.DataBind(); ArrayList semester = new ArrayList(new int[] { 1, 2, 3 }); Semester.DataSource = semester; Semester.DataBind(); if (Request.QueryString["id"] != null) { int CourseId = int.Parse(Request.QueryString["id"]); CourseServiceImpl courseServiceImpl = new CourseServiceImpl(); Course course = (Course)courseServiceImpl.GetById(CourseId); //绑定数据 CourseName.Value = course.Name; DropDownList1.Text = string.Concat(course.ClassId); SchoolYear.Text = course.SchoolYear; Semester.Text = course.Semester; ShortCourseIntro.Value = course.ShortIntroduction; } } }
protected void Page_Load(object sender, EventArgs e) { AuthHelper.LoginCheck(Session, Request, Response, Server); AuthHelper.TeacherOnlyPage(Session, Request, Response, Server); var all = new ClassServiceImpl().GetAll(); DropDownList1.DataSource = all; //绑定班级 DropDownList1.DataTextField = "Name"; DropDownList1.DataValueField = "ClassId"; DropDownList1.DataBind(); ArrayList schoolYear = new ArrayList(); //绑定学年 for (int i = DateTime.Now.Year; i >= DateTime.Now.Year - 6; i--) { schoolYear.Add((i) + "-" + (i + 1)); } SchoolYear.DataSource = schoolYear; SchoolYear.DataBind(); ArrayList semester = new ArrayList(new int[] { 1, 2, 3 }); Semester.DataSource = semester; Semester.DataBind(); }