protected void CoursesGridView_BindGridView() { List <Course> courses = GrouperMethods.GetCourses(); CoursesGridView.DataSource = courses; CoursesGridView.DataBind(); }
//Bind data for previous classes dropdowns protected void ClassesRepeater_BindRepeater() { List <Course> courses = GrouperMethods.GetCourses().Where(x => x.CoreCourseFlag == true).ToList(); ClassesRepeater.DataSource = courses; ClassesRepeater.DataBind(); }
protected void BindDropDownLists() { List <Course> courses = GrouperMethods.GetCourses(); CoursesDropDownList.DataSource = courses; CoursesDropDownList.DataBind(); List <ListItem> years = new List <ListItem>(); for (int i = DateTime.Now.Year; i < DateTime.Now.Year + 10; i++) { ListItem year = new ListItem { Text = i.ToString(), Value = i.ToString() }; years.Add(year); } YearsDropDownList.DataSource = years; YearsDropDownList.DataBind(); List <ListItem> times = new List <ListItem>(); for (int i = 8; i < 19; i++) { for (int j = 0; j < 2; j++) { int hour = i; if (i > 12) { hour = i - 12; } string minutes = (j * 30).ToString(); if (minutes.Length == 1) { minutes += "0"; } string time = hour.ToString() + ":" + minutes; ListItem item = new ListItem { Text = time, Value = time }; times.Add(item); } } TimesDropDownList.DataSource = times; TimesDropDownList.DataBind(); }
//This executes whenever the page is loaded (or re-loaded) protected void Page_Load(object sender, EventArgs e) { //instantiate the student object if (ThisStudent == null) { ThisStudent = new Student(); } if (!TEST_FLAG) { //If the GUID does not idicate a valid student, redirect if ((ThisStudent.SurveySubmittedDate != null) || (GUID == "") || (GUID == null)) { Response.Redirect("Oops.aspx"); } } //Only do these things the firsrt time the page loads (not on post-backs) if (!IsPostBack) { //Fill out name information FirstNameLabel.Text = ThisStudent.FirstName; LastNameLabel.Text = ThisStudent.LastName; PreferedNameTextBox.Text = ThisStudent.FirstName; //Bind data for drop-down repeaters ClassesRepeater_BindRepeater(); RolesRepeater_BindRepeater(); LanguagesRepeater_BindRepeater(); SkillsRepeater_BindRepeater(); //Bind data for current courses section CurrentCoursesDropDownList.DataSource = GrouperMethods.GetCourses(); CurrentCoursesDropDownList.DataBind(); CurrentCoursesGridView.DataSource = null; CurrentCoursesGridView.DataBind(); } }