protected void Fetch_Click01(object sender, EventArgs e) { if (List01.SelectedIndex == 0) { ShowMessage("Select a school to view its programs", "alert alert-warning"); } else { ShowMessage("", ""); try { ProgramsController sysmgr02 = new ProgramsController(); List <Programs> info02 = null; info02 = sysmgr02.FindByID(List01.SelectedValue); info02.Sort((x, y) => x.ProgramName.CompareTo(y.ProgramName)); Fetch02.Enabled = true; List02.Enabled = true; List02.DataSource = info02; List02.DataTextField = nameof(Programs.ProgramName); List02.DataValueField = nameof(Programs.ProgramID); List02.DataBind(); List02.Items.Insert(0, "select..."); } catch (Exception ex) { ShowMessage(ex.ToString(), "alert alert-danger"); } } }
protected void Fetch_Click01(object sender, EventArgs e) { if (List01.SelectedIndex == 0) { MessageLabel.Text = "Select a School to view its Programs"; } else { try { ProgramsController sysmgr02 = new ProgramsController(); List <Programs> info02 = null; info02 = sysmgr02.FindByID(List01.SelectedValue); info02.Sort((x, y) => x.ProgramName.CompareTo(y.ProgramName)); Fetch02.Enabled = true; List02.Enabled = true; List02.DataSource = info02; List02.DataTextField = nameof(Programs.ProgramName); List02.DataValueField = nameof(Programs.ProgramID); List02.DataBind(); List02.Items.Insert(0, "select..."); } catch (Exception ex) { MessageLabel.Text = ex.Message; } } }