Пример #1
0
        //function to get the student attributes
        private void GetStudentAttributes()
        {
            try
            {
                BusinessLogic obj = new BusinessLogic();
                DataTable     tab = new DataTable();

                tab = obj.GetStudentAttributes(TextBox_Reg.Text);

                if (tab.Rows.Count > 0)
                {
                    //Prev Results
                    string dataTextPrev = DropDownListPrevResults.Items.FindByValue(tab.Rows[0]["PrevSemResults"].ToString()).ToString();

                    ListItem itemPrevSemResults  = new ListItem(dataTextPrev, tab.Rows[0]["PrevSemResults"].ToString());
                    int      indexPrevSemResults = DropDownListPrevResults.Items.IndexOf(itemPrevSemResults);

                    if (indexPrevSemResults != -1)
                    {
                        DropDownListPrevResults.SelectedIndex = indexPrevSemResults;
                    }

                    //SSLC
                    string dataTextSSLC = DropDownListSSLC.Items.FindByValue(tab.Rows[0]["SSLC"].ToString()).ToString();

                    ListItem itemSSLC  = new ListItem(dataTextSSLC, tab.Rows[0]["SSLC"].ToString());
                    int      indexSSLC = DropDownListSSLC.Items.IndexOf(itemSSLC);

                    if (indexSSLC != -1)
                    {
                        DropDownListSSLC.SelectedIndex = indexSSLC;
                    }

                    //PUC
                    string dataTextPUC = DropDownListPUC.Items.FindByValue(tab.Rows[0]["PUC"].ToString()).ToString();

                    ListItem itemPUC  = new ListItem(dataTextPUC, tab.Rows[0]["PUC"].ToString());
                    int      indexPUC = DropDownListPUC.Items.IndexOf(itemPUC);

                    if (indexPUC != -1)
                    {
                        DropDownListPUC.SelectedIndex = indexPUC;
                    }


                    //TS
                    string dataTS = DropDownListTS.Items.FindByValue(tab.Rows[0]["TS"].ToString()).ToString();

                    ListItem itemTS  = new ListItem(dataTS, tab.Rows[0]["TS"].ToString());
                    int      indexTS = DropDownListTS.Items.IndexOf(itemTS);

                    if (indexTS != -1)
                    {
                        DropDownListTS.SelectedIndex = indexTS;
                    }

                    //CC
                    string dataCC = DropDownListCC.Items.FindByValue(tab.Rows[0]["CC"].ToString()).ToString();

                    ListItem itemCC  = new ListItem(dataCC, tab.Rows[0]["CC"].ToString());
                    int      indexCC = DropDownListCC.Items.IndexOf(itemCC);

                    if (indexCC != -1)
                    {
                        DropDownListCC.SelectedIndex = indexCC;
                    }

                    //CS
                    string dataCS = DropDownListCS.Items.FindByValue(tab.Rows[0]["CS"].ToString()).ToString();

                    ListItem itemCS  = new ListItem(dataCS, tab.Rows[0]["CS"].ToString());
                    int      indexCS = DropDownListCS.Items.IndexOf(itemCS);

                    if (indexCS != -1)
                    {
                        DropDownListCS.SelectedIndex = indexCS;
                    }

                    //CA
                    string dataCA = DropDownListCA.Items.FindByValue(tab.Rows[0]["CA"].ToString()).ToString();

                    ListItem itemCA  = new ListItem(dataCA, tab.Rows[0]["CA"].ToString());
                    int      indexCA = DropDownListCA.Items.IndexOf(itemCA);

                    if (indexCA != -1)
                    {
                        DropDownListCA.SelectedIndex = indexCA;
                    }
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "key", "<script>alert('Student Parameters Not Updated!!!')</script>");
                }
            }
            catch
            {
            }
        }