private void BindGrid() { GridView2.DataBind(); if (PrjPub.StudentID != null && PrjPub.StudentID != "") { string struesrId = PrjPub.StudentID; ExamBLL bkLL = new ExamBLL(); IList <RailExam.Model.Exam> ExamList = bkLL.GetExamByUserId(struesrId, 0, PrjPub.ServerNo); this.GridView4.DataSource = ExamList; this.GridView4.DataBind(); //即将考试 IList <RailExam.Model.Exam> ExamList1 = bkLL.GetComingExamByUserId(struesrId); this.GridView3.DataSource = ExamList1; this.GridView3.DataBind(); //历史考试 IList <RailExam.Model.Exam> ExamList2 = bkLL.GetHistoryExamByUserId(struesrId); this.GridView5.DataSource = ExamList2; this.GridView5.DataBind(); gvExamResult.Visible = true; } else { ExamBLL bkLL = new ExamBLL(); IList <RailExam.Model.Exam> ExamList = bkLL.GetNowExam(); this.GridView4.DataSource = ExamList; this.GridView4.DataBind(); IList <RailExam.Model.Exam> ExamList1 = bkLL.GetComingExam(); this.GridView3.DataSource = ExamList1; this.GridView3.DataBind(); IList <RailExam.Model.Exam> ExamList2 = bkLL.GetHistoryExam(); this.GridView5.DataSource = ExamList2; this.GridView5.DataBind(); gvExamResult.Visible = false; } }