Example #1
0
        private void bind()
        {
            string id = Request.QueryString["id"].ToString();

            ClassBLL classBLL = new ClassBLL();

            clazz = classBLL.get(id);

            //初始化DropDownList_teacher的绑定值
            TeacherBLL teachBLL = new TeacherBLL();

            DropDownList_teacher.DataSource     = teachBLL.getClassTeachers();
            DropDownList_teacher.DataTextField  = "name";
            DropDownList_teacher.DataValueField = "ID";
            DropDownList_teacher.DataBind();

            //初始化DropDownList_monitor的绑定值
            StudentBLL studBLL = new StudentBLL();

            DropDownList_monitor.DataSource     = studBLL.getByClassId(id);
            DropDownList_monitor.DataTextField  = "name";
            DropDownList_monitor.DataValueField = "ID";
            DropDownList_monitor.DataBind();
            DropDownList_monitor.Items.Insert(0, "无");

            TextBox_className.Text = clazz.Name;
            PageUtil.bindDropDownList(DropDownList_depart, clazz.Depart);
            PageUtil.bindDropDownList(DropDownList_grade, clazz.Grade);
            PageUtil.bindDropDownList(DropDownList_teacher, clazz.TeacherID);
            PageUtil.bindDropDownList(DropDownList_monitor, clazz.MonitorID);
        }
        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();
            }
        }
Example #3
0
        /// <summary>
        /// 绑定数据源
        /// </summary>
        private void bind()
        {
            TeacherBLL teachBLL = new TeacherBLL();

            DropDownList_teacher.DataSource     = teachBLL.getClassTeachers();
            DropDownList_teacher.DataTextField  = "name";
            DropDownList_teacher.DataValueField = "ID";
            DropDownList_teacher.DataBind();
        }
        /// <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();
        }