protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ClassBLL classBLL = new ClassBLL();
                CourseBLL courBLL = new CourseBLL();
                TeacherBLL teachBLL = new TeacherBLL();
                //绑定页面查询条件的数据
                DropDownList_class.DataSource = classBLL.getAll();
                DropDownList_class.DataTextField = "name";
                DropDownList_class.DataBind();
                DropDownList_class.Items.Insert(0, "全部班级");

                DropDownList_course.DataSource = courBLL.getAll();
                DropDownList_course.DataTextField = "name";
                DropDownList_course.DataBind();
                DropDownList_course.Items.Insert(0, "全部课程");

                DropDownList_teacher.DataSource = teachBLL.getTeachers();
                DropDownList_teacher.DataTextField = "name";
                DropDownList_teacher.DataBind();
                DropDownList_teacher.Items.Insert(0, "全部教师");

                bind();
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ClassBLL classBLL = new ClassBLL();
         //绑定页面查询条件的数据
         DropDownList_class.DataSource = classBLL.getAll();
         DropDownList_class.DataTextField = "name";
         DropDownList_class.DataBind();
         DropDownList_class.Items.Insert(0, "全院");
         bind();
     }
 }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ClassBLL classBLL = new ClassBLL();

                DropDownList_class.DataSource = classBLL.getAll();
                DropDownList_class.DataTextField = "name";
                DropDownList_class.DataValueField = "ID";
                DropDownList_class.DataBind();
                bind();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                CourseTableBLL ctBLL = new CourseTableBLL();
                ClassBLL classBLL = new ClassBLL();
                CourseBLL courBLL = new CourseBLL();
                TeacherBLL teachBLL = new TeacherBLL();

                DropDownList_class.DataSource = classBLL.getAll();
                DropDownList_class.DataTextField = "name";
                DropDownList_class.DataValueField = "ID";
                DropDownList_class.DataBind();

                DropDownList_course.DataSource = courBLL.getByClassId(DropDownList_class.SelectedValue);
                DropDownList_course.DataTextField = "name";
                DropDownList_course.DataValueField = "ID";
                DropDownList_course.DataBind();

                string filterTeacher = "classID='" + DropDownList_class.SelectedValue + "' and courId='" + DropDownList_course.SelectedValue + "'";
                DataTable tempDt = PageUtil.getProcessedDataTable(ctBLL.getAll().Tables[0], filterTeacher, null, false);

                DataView dv = tempDt.DefaultView;
                tempDt = dv.ToTable(true, "teachID");
                foreach (DataRow dr in tempDt.Rows)
                {
                    Teacher teacher = teachBLL.get(dr["teachID"].ToString());
                    DropDownList_teacher.Items.Add(new ListItem(teacher.Name, teacher.Id));
                }

                bind();
            }
        }
示例#5
0
        /// <summary>
        /// 绑定数据源
        /// </summary>
        private void bind()
        {
            CourseBLL courBLL = new CourseBLL();
            TeacherBLL teacherBLL = new TeacherBLL();
            ClassBLL classBLL = new ClassBLL();

            //绑定 "课程名称" 数据源
            DropDownList_course.DataSource = courBLL.getAll();
            DropDownList_course.DataTextField = "name";
            DropDownList_course.DataValueField = "ID";
            DropDownList_course.DataBind();

            //绑定 "任课老师" 数据源
            DropDownList_teacher.DataSource = teacherBLL.getTeachers();
            DropDownList_teacher.DataTextField = "name";
            DropDownList_teacher.DataValueField = "ID";
            DropDownList_teacher.DataBind();

            //绑定 "班级名称" 数据源
            DropDownList_class.DataSource = classBLL.getAll();
            DropDownList_class.DataTextField = "name";
            DropDownList_class.DataValueField = "ID";
            DropDownList_class.DataBind();
        }