public void DataListBindEnglishExamNotify() { DalOperationAboutEnglishExam dalOperationAboutEnglishExam = new DalOperationAboutEnglishExam(); DataTable dt = dalOperationAboutEnglishExam.GetEnglishExamNotifyByLocale(ddlEnglishExamNotifyLocale.SelectedValue).Tables[0]; DataView dv = dt.DefaultView; this.AspNetPager1.RecordCount = dv.Count; AspNetPager1.PageSize = CommonUtility.pageSize; PagedDataSource pds = new PagedDataSource(); //定义一个PagedDataSource类来执行分页功 pds.DataSource = dv; pds.AllowPaging = true; pds.CurrentPageIndex = pageIndex - 1; pds.PageSize = AspNetPager1.PageSize; this.dlstEnglishExamNotify.DataSource = pds; this.dlstEnglishExamNotify.DataBind(); if (pds.Count == 0) { this.dlstEnglishExamNotify.ShowFooter = true; } else { this.dlstEnglishExamNotify.ShowFooter = false; } }
protected void Page_Load(object sender, EventArgs e) { //控制Tab的显示 UserCookiesInfo UserCookiesInfo = BllOperationAboutUser.GetUserCookiesInfo(); if (Request["fragment"] != null) { fragmentFlag = Request["fragment"]; } CommonUtility.ShowLiControl(fragmentFlag, liFragment1, liFragment2, liFragment3 , divFragment1, divFragment2, divFragment3); if (!IsPostBack) { if (fragmentFlag == "1") { DalOperationAboutEnglishExam dal = new DalOperationAboutEnglishExam(); DataTable _dt = dal.GetLocaleByStudentNo(UserCookiesInfo.userNo).Tables[0]; DataSet ds = dal.GetEnglishExamNotifyByLocale(_dt.Rows.Count > 0 ? _dt.Rows[0]["locale"].ToString().Trim() : string.Empty); DataRowCollection drc = ds.Tables[0].Rows; if (drc.Count == 0) { tbEnglishtSignUp.Visible = false; Javascript.AlertAndRedirect("您好,当前无四六级报名信息!", "/Student/EnglishExamSignUp.aspx?fragment=2", Page); return; } for (int i = 0; i < 1; i++) { ddlEnglishExamNotify.Items.Add(new ListItem(drc[i]["englishExamNotifyTitle"].ToString().Trim(), drc[i]["englishExamNotifyId"].ToString().Trim())); } if (dal.CheckHasSignUpInfo(UserCookiesInfo.userNo, int.Parse(ddlEnglishExamNotify.SelectedValue)) > 0) { Javascript.AlertAndRedirect("您好,当前已经报名,点击确定查看报名信息", "/Student/EnglishExamSignUp.aspx?fragment=2", Page); return; } StudentsList studentList = dal.GetEnglishExamSignUpStudentInfoByStudentNo(UserCookiesInfo.userNo); ltlName.Text = studentList.studentName; ltlSex.Text = (studentList.Sex == 1 ? "女" : "男"); ltlStudentNo.Text = studentList.studentNo; ltlCardType.Text = studentList.CardType; ltlCardNum.Text = studentList.CardNum; ltlMatriculationDate.Text = studentList.MatriculationDate.ToString("yyyy-MM-dd"); ltlMajor.Text = studentList.studentSpeciality; ltlSchoolClass.Text = studentList.SchoolClassName; } if (fragmentFlag == "2") { DalOperationAboutEnglishExam dal = new DalOperationAboutEnglishExam(); dlstEnglishExamSignUp.DataSource = dal.GetAllEnglishExamSignUpInfoByStudentNo(UserCookiesInfo.userNo); dlstEnglishExamSignUp.DataBind(); } } }