TableRow generateStudentRow(Student student, List <SchoolDay> days) { TableRow newRow = new TableRow(); TableCell cell_ID = new TableCell(); cell_ID.CssClass = "datatable_row"; cell_ID.Text = student.getStudentID(); newRow.Cells.Add(cell_ID); TableCell cell_FirstName = new TableCell(); cell_FirstName.CssClass = "datatable_row"; cell_FirstName.Text = student.getFirstName(); newRow.Cells.Add(cell_FirstName); TableCell cell_LastName = new TableCell(); cell_LastName.CssClass = "datatable_row"; cell_LastName.Text = student.getLastName(); newRow.Cells.Add(cell_LastName); foreach (SchoolDay day in days) { StringBuilder timeTableInfo = new StringBuilder(); List <TimeTableEntry> thisDayClasses = new List <TimeTableEntry>(); foreach (TimeTableEntry tte in student.TimeTable) { if (tte.dayNum == day.dayNumber) { thisDayClasses.Add(tte); } } thisDayClasses.Sort(); if (thisDayClasses.Count > 0) { TimeTableEntry firstClassOfTheDay = TimeTableEntry.getEarliest(thisDayClasses); //timeTableInfo.Append(firstClassOfTheDay.schoolClass.name + " (Teacher: " + firstClassOfTheDay.schoolClass.teacherName + ", Room: " + firstClassOfTheDay.roomName + ", Period: " + firstClassOfTheDay.blockNum + ")"); timeTableInfo.Append(firstClassOfTheDay.ToStringFormatted()); } else { timeTableInfo.Append("No classes today"); } TableCell cell_Day = new TableCell(); cell_Day.VerticalAlign = VerticalAlign.Top; cell_Day.CssClass = "datatable_row"; cell_Day.Text = timeTableInfo.ToString(); newRow.Cells.Add(cell_Day); } return(newRow); }