Exemple #1
0
 private void Sections_Old_Data()
 {
     for (int iterator = 0; iterator < 10; iterator++)
     {
         SectionsDropdown.RemoveItem("");
     }
 }
Exemple #2
0
        private void RetrieveAssignedSections()
        {
            string RetrieveQuery = "SELECT * FROM [Tbl.AssignedSections] WHERE [TEACHER ID] = '" + TeacherID + "'";

            sqlcommand = new SqlCommand(RetrieveQuery, sqlconnection);
            SqlDataReader sqldatareader = sqlcommand.ExecuteReader();

            while (sqldatareader.Read())
            {
                int index = 2;
                for (int iterator = 0; iterator < 10; iterator++)
                {
                    SectionsDropdown.AddItem(sqldatareader.GetString(index));
                    index++;
                }
            }
            sqldatareader.Close();
            Sections_Old_Data();

            try
            {
                SectionsDropdown.selectedIndex          = 0;
                SectionsGridView.Rows[0].Cells[1].Value = SectionsDropdown.selectedValue.ToString();

                SectionsDropdown.selectedIndex          = 1;
                SectionsGridView.Rows[1].Cells[1].Value = SectionsDropdown.selectedValue.ToString();

                SectionsDropdown.selectedIndex          = 2;
                SectionsGridView.Rows[2].Cells[1].Value = SectionsDropdown.selectedValue.ToString();

                SectionsDropdown.selectedIndex          = 3;
                SectionsGridView.Rows[3].Cells[1].Value = SectionsDropdown.selectedValue.ToString();

                SectionsDropdown.selectedIndex          = 4;
                SectionsGridView.Rows[4].Cells[1].Value = SectionsDropdown.selectedValue.ToString();

                SectionsDropdown.selectedIndex          = 5;
                SectionsGridView.Rows[5].Cells[1].Value = SectionsDropdown.selectedValue.ToString();

                SectionsDropdown.selectedIndex          = 6;
                SectionsGridView.Rows[6].Cells[1].Value = SectionsDropdown.selectedValue.ToString();

                SectionsDropdown.selectedIndex          = 7;
                SectionsGridView.Rows[7].Cells[1].Value = SectionsDropdown.selectedValue.ToString();

                SectionsDropdown.selectedIndex          = 8;
                SectionsGridView.Rows[8].Cells[1].Value = SectionsDropdown.selectedValue.ToString();

                SectionsDropdown.selectedIndex          = 9;
                SectionsGridView.Rows[9].Cells[1].Value = SectionsDropdown.selectedValue.ToString();
            }

            catch (Exception)
            {
                //DON'T DO ANYTHING BITCH !
            }
        }