private void PopulateClassList(List <IdAndName> selectedList = null) { using (var helper = new DbHelper.Classes()) { if (selectedList != null) { //var roles = ViewState["Roles"] as List<string>; var list = helper.ListCurrentClassesOfTeacher(SubjectId, UserId, IsManager, selectedList); //list.ForEach(x => //{ // if (x.HasGrouping) // { // //x. // } //}); list.Insert(0, new SubjectClass() { Name = "", Id = 0 }); ddlClass.DataSource = list; ddlClass.DataBind(); } else { var selected = ViewState["SelectedClasses"] as List <IdAndName>; //var roles = ViewState["Roles"] as List<string>; var list = helper.ListCurrentClassesOfTeacher(SubjectId, UserId, IsManager, selected); list.Insert(0, new SubjectClass() { Name = "", Id = 0 }); ddlClass.DataSource = list; ddlClass.DataBind(); } } }