private void LoadEditor()
        {
            using (WebhostEntities db = new WebhostEntities())
            {
                Credit credit = db.Credits.Where(c => c.id == CreditId).Single();

                CreditTypeDDL.DataSource     = GradeTableEntryListItem.GetDataSource(credit.CreditType.GradeTable.GradeTableEntries.Select(g => g.id).ToList());
                CreditTypeDDL.DataTextField  = "Text";
                CreditTypeDDL.DataValueField = "ID";
                CreditTypeDDL.DataBind();

                CreditTypeDDL.ClearSelection();
                CreditTypeDDL.SelectedValue = Convert.ToString(credit.CreditTypeId);

                CreditValueDDL.DataSource     = GradeTableEntryListItem.GetDataSource(credit.CreditValue.GradeTable.GradeTableEntries.Select(g => g.id).ToList());
                CreditValueDDL.DataTextField  = "Text";
                CreditValueDDL.DataValueField = "ID";
                CreditValueDDL.DataBind();

                CreditValueDDL.ClearSelection();
                CreditValueDDL.SelectedValue = Convert.ToString(credit.CreditValueId);

                NotesInput.Text = credit.Notes;

                UpdateAll.Checked = credit.Sections.Count > 1;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int year = DateRange.GetCurrentAcademicYear();
                using (WebhostEntities db = new WebhostEntities())
                {
                    StudentSelect.DataSource     = StudentListItem.GetDataSource(db.Students.Where(s => s.isActive).OrderBy(s => s.GraduationYear).ThenBy(s => s.LastName).ThenBy(s => s.FirstName).Select(s => s.ID).ToList());
                    StudentSelect.DataTextField  = "Text";
                    StudentSelect.DataValueField = "ID";
                    StudentSelect.DataBind();

                    CreditTypeDDL.DataSource     = GradeTableEntryListItem.GetDataSource(db.GradeTables.Where(t => t.Name.Equals("Credit Types") && t.AcademicYearID == year).Single().GradeTableEntries.Select(d => d.id).ToList());
                    CreditTypeDDL.DataTextField  = "Text";
                    CreditTypeDDL.DataValueField = "ID";
                    CreditTypeDDL.DataBind();

                    CreditValueDDL.DataSource     = GradeTableEntryListItem.GetDataSource(db.GradeTables.Where(t => t.Name.Equals("Credit Values") && t.AcademicYearID == year).Single().GradeTableEntries.Select(d => d.id).ToList());
                    CreditValueDDL.DataTextField  = "Text";
                    CreditValueDDL.DataValueField = "ID";
                    CreditValueDDL.DataBind();
                }
            }
        }