protected void CoursesGridView_BindGridView() { List <Course> courses = GrouperMethods.GetCourses(); CoursesGridView.DataSource = courses; CoursesGridView.DataBind(); }
protected void CoursesGridView_PageIndexChanging(object sender, GridViewPageEventArgs e) { CoursesGridView.DataSource = OrganizationCourses; CoursesGridView.PageIndex = e.NewPageIndex; CoursesGridView.DataBind(); GlobalUtils.SetAccessToControls(this.Page, SaltShakerSession.CurrentRole); }
/** * <summary> * This method gets the course data from the DB * </summary> * * @method GetCourse * @returns {void} */ protected void GetCourses() { //connect to EF using (DefaultConnection db = new DefaultConnection()) { //query the students table using EF and LINQ var Courses = (from allCourses in db.Courses select allCourses); //bind the results to the gridview CoursesGridView.DataSource = Courses.ToList(); CoursesGridView.DataBind(); } }
/// <summary> /// This method gets the courses data from the DB /// </summary> private void GetCourse() { // connect to EF DB using (MyContext db = new MyContext()) { // query the Courses Table using EF and LINQ var CoursesData = (from allcourse in db.Courses select allcourse); // bind the result to the course GridView CoursesGridView.DataSource = CoursesData.ToList(); CoursesGridView.DataBind(); } }
protected void BindGridView() { string userName = Context.User.Identity.GetUserName(); List <InstructorCourse> courses = new List <InstructorCourse>(); if (!string.IsNullOrEmpty(userName)) { Instructor instructor = GrouperMethods.GetInstructor(userName); if (instructor != null) { InstructorNameLabel.Text = instructor.FirstName + " " + instructor.LastName; } courses = GrouperMethods.GetInstructorCourses(instructor.InstructorID); if (courses.Count > 0) { CoursesPanel.Visible = true; NoCoursesPanel.Visible = false; AddCourseSectionPanel.Visible = false; } else { AddCourseSectionPanel.Visible = false; NoCoursesPanel.Visible = true; CoursesPanel.Visible = false; } } //else //{ // courses = GrouperMethods.GetInstructorCourses(); //} CoursesGridView.DataSource = courses; CoursesGridView.DataBind(); }
private void renderCoursesGridView() { CoursesGridView.DataSource = OrganizationCourses; CoursesGridView.DataBind(); }