コード例 #1
0
        private void PopulateClassNames(int val)
        {
            ClassNames        classNames    = new ClassNames(_connString);
            List <ClassNames> classNameList = classNames.GetClass_Names();

            foreach (ClassNames className in classNameList)
            {
                ComboBoxItem item = new ComboBoxItem();
                item.Text  = className.Description;
                item.Value = className.Class_Name_ID;

                cboClassNames.Items.Add(item);
                if (className.Class_Name_ID == val)
                {
                    cboClassNames.Text = className.Description;
                }
            }
        }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _connString       = ConfigurationManager.ConnectionStrings["SSSDbConnDev"].ConnectionString;
        Common.ConnString = _connString;

        if (!string.IsNullOrEmpty(Common.Show_Entry_Class_ID))
        {
            Show_Entry_Class_ID = Common.Show_Entry_Class_ID;
        }

        if (!string.IsNullOrEmpty(Common.Club_ID))
        {
            Club_ID                = Common.Club_ID;
            divGetClub.Visible     = false;
            divClubDetails.Visible = true;
        }
        else
        {
            divGetClub.Visible     = true;
            divClubDetails.Visible = false;
        }

        if (!string.IsNullOrEmpty(Common.Show_ID))
        {
            Show_ID                = Common.Show_ID;
            divGetShow.Visible     = false;
            divShowDetails.Visible = true;
        }
        else
        {
            divGetShow.Visible     = true;
            divShowDetails.Visible = false;
        }

        if (!string.IsNullOrEmpty(Common.Class_Name_ID))
        {
            Class_Name_ID = Common.Class_Name_ID;
            lstClassNames.SelectedValue = Class_Name_ID;
        }
        if (!string.IsNullOrEmpty(Common.Class_No))
        {
            Class_No        = Common.Class_No;
            txtClassNo.Text = Class_No;
        }
        if (string.IsNullOrEmpty(Common.Class_Gender))
        {
            Class_Gender = Common.Class_Gender;
            lstClassGender.SelectedValue = Class_Gender;
        }

        if (!string.IsNullOrEmpty(Club_ID))
        {
            PopulateClub(Club_ID);
        }
        if (!string.IsNullOrEmpty(Show_ID))
        {
            PopulateShow(Show_ID);
            PopulateClassGridview(Show_ID);
        }
        if (!Page.IsPostBack)
        {
            string returnChars = Request.QueryString["return"];
            btnReturn.PostBackUrl = Common.ReturnPath(Request.QueryString, returnChars, null);

            // Populate the ShowType listbox
            ClassNames        classNames = new ClassNames(_connString);
            List <ClassNames> lkpClassNames;
            lkpClassNames            = classNames.GetClass_Names();
            lstClassNames.DataSource = lkpClassNames;
            lstClassNames.DataBind();
            // Populate the ClassGender ListBox
            ListItemCollection classGenderList = new ListItemCollection();
            ListItem           classGenderNS   = new ListItem("Please Select...", Constants.CLASS_GENDER_NS.ToString());
            classGenderList.Add(classGenderNS);
            ListItem classGenderDB = new ListItem("Dog & Bitch", Constants.CLASS_GENDER_DB.ToString());
            classGenderList.Add(classGenderDB);
            ListItem classGenderD = new ListItem("Dog", Constants.CLASS_GENDER_D.ToString());
            classGenderList.Add(classGenderD);
            ListItem classGenderB = new ListItem("Bitch", Constants.CLASS_GENDER_B.ToString());
            classGenderList.Add(classGenderB);
            lstClassGender.DataSource = classGenderList;
            lstClassGender.DataBind();
        }
    }