//Method that binds all of the data to the dropdown menus protected void BindBasicData() { SchoolList.DataSource = CreateSchoolList(); SchoolList.DataTextField = "SchoolName"; SchoolList.DataValueField = "SchoolValue"; JobList.DataSource = CreateJobList(); JobList.DataTextField = "JobName"; JobList.DataValueField = "JobValue"; JobList_HS.DataSource = CreateJobList(); JobList_HS.DataTextField = "JobName"; JobList_HS.DataValueField = "JobValue"; SchoolList.DataBind(); JobList.DataBind(); JobList_HS.DataBind(); }
protected void SchoolDataBind() { try { SchoolController sysmgr = new SchoolController(); List <School> info = sysmgr.School_List(); info.Sort((x, y) => x.SchoolName.CompareTo(y.SchoolName)); SchoolList.DataSource = info; SchoolList.DataValueField = "SchoolCode"; SchoolList.DataTextField = "SchoolName"; SchoolList.DataBind(); SchoolList.Items.Insert(0, "select ..."); } catch (DbUpdateException ex) { UpdateException updateException = (UpdateException)ex.InnerException; if (updateException.InnerException != null) { errormsgs.Add(updateException.InnerException.Message.ToString()); } else { errormsgs.Add(updateException.Message); } LoadMessageDisplay(errormsgs, "alert alert-danger"); } catch (DbEntityValidationException ex) { foreach (var entityValidationErrors in ex.EntityValidationErrors) { foreach (var validationError in entityValidationErrors.ValidationErrors) { errormsgs.Add(validationError.ErrorMessage); } } LoadMessageDisplay(errormsgs, "alert alert-danger"); } catch (Exception ex) { errormsgs.Add(GetInnerException(ex).ToString()); LoadMessageDisplay(errormsgs, "alert alert-danger"); } }
protected void BindSchoolList() { try { SchoolController sysmgr = new SchoolController(); List <Schools> info = null; info = sysmgr.List(); info.Sort((x, y) => x.SchoolName.CompareTo(y.SchoolName)); SchoolList.DataSource = info; SchoolList.DataTextField = nameof(Schools.SchoolName); SchoolList.DataValueField = nameof(Schools.SchoolCode); SchoolList.DataBind(); SchoolList.Items.Insert(0, "select..."); } catch (Exception ex) { errormsgs.Add(GetInnerException(ex).ToString()); LoadMessageDisplay(errormsgs, "alert alert-danger"); } }
protected void BindSchoolList() { try { SchoolController sysmgr = new SchoolController(); List <Schools> info = null; info = sysmgr.List(); info.Sort((x, y) => x.SchoolCode.CompareTo(y.SchoolCode)); SchoolList.DataSource = info; SchoolList.DataTextField = nameof(Schools.SchoolName); SchoolList.DataValueField = nameof(Schools.SchoolCode); SchoolList.DataBind(); ListItem myitem = new ListItem(); myitem.Value = "0"; myitem.Text = "select..."; SchoolList.Items.Insert(0, myitem); } catch (Exception ex) { ShowMessage(GetInnerException(ex).ToString(), "alert alert-danger"); } }