protected void BindList() { try { Fetch02.Enabled = false; List02.Enabled = false; SchoolControllers sysmgr = new SchoolControllers(); List <School> info = null; info = sysmgr.List(); info.Sort((x, y) => x.SchoolName.CompareTo(y.SchoolName)); List01.DataSource = info; List01.DataTextField = nameof(School.SchoolCode); List01.DataValueField = nameof(School.SchoolName); List01.DataBind(); List01.Items.Insert(0, "select..."); } catch (Exception ex) { MessageLabel.Text = ex.Message; } }
protected void BindSchoolList() { try { SchoolControllers sysmgr = new SchoolControllers(); List <School> info = null; info = sysmgr.List(); info.Sort((x, y) => x.SchoolName.CompareTo(y.SchoolName)); SchoolList.DataSource = info; SchoolList.DataTextField = nameof(School.SchoolName); SchoolList.DataValueField = nameof(School.SchoolCode); SchoolList.DataBind(); ListItem myitem = new ListItem(); myitem.Value = "0"; myitem.Text = "select..."; SchoolList.Items.Insert(0, myitem); //CategoryList.Items.Insert(0, "select..."); } catch (Exception ex) { ShowMessage(GetInnerException(ex).ToString(), "alert alert-danger"); } }