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();
            }
        }
Beispiel #2
0
        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();
            }
        }
Beispiel #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();
            }
        }
    protected void SetItemForDropDownList_Class()
    {
        //string sql = "select class_id,class_name from temp_class where class_grade = '" + DropDownList_Grade.SelectedValue + "'";
        string         sql = "select distinct ClassNo,class_name from gcgLectureForm, temp_class where gcgLectureForm.ClassNo = temp_class.class_id and class_grade = '" + DropDownList_Grade.SelectedValue + "'";
        DBManipulation dbm = new DBManipulation();
        DataSet        ds  = dbm.ExecuteQueryOffLine(sql, null);

        DropDownList_class.AutoPostBack   = true;
        DropDownList_class.DataSource     = ds.Tables["defaultTable"];
        DropDownList_class.DataTextField  = ds.Tables["defaultTable"].Columns[1].ColumnName;
        DropDownList_class.DataValueField = ds.Tables["defaultTable"].Columns[0].ColumnName;
        DropDownList_class.DataBind();
    }
Beispiel #5
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.DataBind();
         DropDownList_class.Items.Insert(0, "全院");
         bind();
     }
 }
        /// <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();
        }