コード例 #1
0
        }//end page load method

        // Fill page controls with updated information
        public void FillControls()
        {
            expertObj = (Expert)Session["expertProfileObj"];
            if (expertObj != null)
            {
                SkillGroupDropdown.DataSource = DbMethods.GetAllSkillGroups();
                SkillGroupDropdown.DataValueField = "SkillGroupID";
                SkillGroupDropdown.DataTextField = "SkillGroupName";
                SkillGroupDropdown.DataBind();
                SkillGroupDropdown.SelectedIndex = SkillGroupDropdown.Items.IndexOf(SkillGroupDropdown.Items.FindByValue(expertObj.skillGroupID.ToString()));

                txtFirstName.Text = expertObj.firstName;
                txtLastName.Text = expertObj.lastName;
                txtUsername.Text = expertObj.username;
                txtEmail.Text = expertObj.email;
                txtPhoneNumber.Text = expertObj.phoneNumber;
                txtLinkedIn.Text = expertObj.linkedIn;
                aboutMe.Text = expertObj.aboutMe;

                //get all Expert's skills and put them on the page
                if (expertObj.AllExpertSkills.Count == 0)
                {
                    lblDeleteTest.Text = "You (the Expert) don't have any skils in your profile. Please add some on this page.";
                    gvDeleteSkills.DataSource = null;
                    gvDeleteSkills.DataBind();
                }
                else
                {
                    this.gvDeleteSkills.DataSource = expertObj.AllExpertSkills;
                    this.gvDeleteSkills.DataBind();
                }
            }//end if
        }//end fill controls
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Authenticated"] == null)
            {
                Response.Redirect("default.aspx");
            }
            else if (!Page.IsPostBack)
            {
                SkillGroupDropdown.DataSource     = db.GetAllSkillGroups();
                SkillGroupDropdown.DataTextField  = "SkillGroupName";
                SkillGroupDropdown.DataValueField = "SkillGroupID";
                SkillGroupDropdown.DataBind();

                genderDropdown.DataSource     = db.GetAllGenders();
                genderDropdown.DataTextField  = "GenderName";
                genderDropdown.DataValueField = "GenderID";
                genderDropdown.DataBind();

                ethnicityDropdown.DataSource     = db.GetAllEthnicities();
                ethnicityDropdown.DataTextField  = "EthnicityName";
                ethnicityDropdown.DataValueField = "EthnicityID";
                ethnicityDropdown.DataBind();

                /*Security Session Variable*/
                Session["Authenticated"] = true;

                txtFirstName.Text = (string)Session["First_Name"];
                txtLastName.Text  = (string)Session["Last_Name"];
                txtEmail.Text     = (string)Session["Email"];
            }
        }