private void LoadSectionsList() { try { Bunifu.Framework.UI.BunifuDropdown VirtualDropdown; VirtualDropdown = new Bunifu.Framework.UI.BunifuDropdown(); string RetrieveQuery = "SELECT TOP 10 [SECTION NAME] FROM [Tbl.Sections] WHERE [SCHOOL YEAR] = '" + CurrentSchoolYear + "'"; sqlcommand = new SqlCommand(RetrieveQuery, sqlconnection); SqlDataReader sqldatareader = sqlcommand.ExecuteReader(); Init_FirstIndex_Dropdowns(); Select_Dropdown_Index(); while (sqldatareader.Read()) { VirtualDropdown.AddItem(sqldatareader.GetString(0)); } sqldatareader.Close(); VirtualDropdown.selectedIndex = 0; Handled_Sec1_Dropdown.AddItem(VirtualDropdown.selectedValue.ToString()); VirtualDropdown.selectedIndex = 1; Handled_Sec2_Dropdown.AddItem(VirtualDropdown.selectedValue.ToString()); VirtualDropdown.selectedIndex = 2; Handled_Sec3_Dropdown.AddItem(VirtualDropdown.selectedValue.ToString()); VirtualDropdown.selectedIndex = 3; Handled_Sec4_Dropdown.AddItem(VirtualDropdown.selectedValue.ToString()); VirtualDropdown.selectedIndex = 4; Handled_Sec5_Dropdown.AddItem(VirtualDropdown.selectedValue.ToString()); VirtualDropdown.selectedIndex = 5; Handled_Sec6_Dropdown.AddItem(VirtualDropdown.selectedValue.ToString()); VirtualDropdown.selectedIndex = 6; Handled_Sec7_Dropdown.AddItem(VirtualDropdown.selectedValue.ToString()); VirtualDropdown.selectedIndex = 7; Handled_Sec8_Dropdown.AddItem(VirtualDropdown.selectedValue.ToString()); VirtualDropdown.selectedIndex = 8; Handled_Sec9_Dropdown.AddItem(VirtualDropdown.selectedValue.ToString()); VirtualDropdown.selectedIndex = 9; Handled_Sec10_Dropdown.AddItem(VirtualDropdown.selectedValue.ToString()); } catch (Exception) { //DONT DISPLAY ANYTHING SHIT ! } }
private void Init_FirstIndex_Dropdowns() { Handled_Sec1_Dropdown.AddItem("NOT SET"); Handled_Sec2_Dropdown.AddItem("NOT SET"); Handled_Sec3_Dropdown.AddItem("NOT SET"); Handled_Sec4_Dropdown.AddItem("NOT SET"); Handled_Sec5_Dropdown.AddItem("NOT SET"); Handled_Sec6_Dropdown.AddItem("NOT SET"); Handled_Sec7_Dropdown.AddItem("NOT SET"); Handled_Sec8_Dropdown.AddItem("NOT SET"); Handled_Sec9_Dropdown.AddItem("NOT SET"); Handled_Sec10_Dropdown.AddItem("NOT SET"); }