/* * Method: GenerateGridData * Areguments: none * Return: none * Des: this method is to fill the GridView with data */ protected void GenerateGridData() { DataTable table = new DataTable(); // declare and instantiate DataTable object /* * Add Columns to the data table */ table.Columns.Add("Course Id"); table.Columns.Add("Section Id"); table.Columns.Add("Course Name"); table.Columns.Add("Instructor Name"); table.Columns.Add("Mark"); foreach (SectionStudent sectionStudent in sectionStudentList.List) { /* * Foreach Element in the sectionStudentList */ section = new Section(sectionStudent.SectionID); // create new section object and pass the section id to it sectionList.Populate(section); // populate the section object instructor = new Instructor(section.InstructorID); // create new instructor object and pass the id to it instructorList.Populate(instructor); // populate the instructor object taughtCourses = new TaughtCourse(section.TaughtCourseID); // create new TaughtCourse object and pass the TaughtCourse id to it taughtCoursesList.Populate(taughtCourses); // populate TaughtCourse course = new Course(taughtCourses.CourseID); // create new course object and pass the course id to it courseList.Populate(course); //populate the course object table.Rows.Add(course.getID(), section.getID(), course.Title, instructor.FirstName + " " + instructor.LastName, sectionStudent.Grade); // add a row to the dataTable object with the information from the above objects } MarksGrid.DataSource = table; // set the dataTable object as the dataSource of the GidView element MarksGrid.DataBind(); // bind the data }
private void MarksGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { MarksGrid.UnselectAllCells(); }