Ejemplo n.º 1
0
        protected void TermSelect_SelectedIndexChanged(object sender, EventArgs e)
        {
            ClassSelect.Enabled = true;
            using (WebhostEntities db = new WebhostEntities())
            {
                int     tid     = Convert.ToInt32(TermSelect.SelectedValue);
                int     sid     = this.user.ID;
                Student student = db.Students.Where(s => s.ID == sid).Single();

                List <int> sectionIds = new List <int>();
                foreach (StudentComment comment in student.StudentComments.ToList())
                {
                    if (comment.CommentHeader.TermIndex == tid)
                    {
                        sectionIds.Add(comment.CommentHeader.SectionIndex);
                    }
                }

                ClassSelect.DataSource     = SectionListItem.GetDataSource(sectionIds);
                ClassSelect.DataTextField  = "Text";
                ClassSelect.DataValueField = "ID";
                ClassSelect.DataBind();
                ReadonlyCommentViewer1.Visible = false;
            }
        }