Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //bind texts and placeholders
            lblChildNickname.Text = Model.Childnicknameplaceholder.Rendered;
            txtChildNickname.Attributes["placeholder"] = Server.HtmlDecode(Model.Childnicknameplaceholder.Text);
            btnSubmit.Text                 = Model.SeeMyRecommendationsText.Rendered;
            hypCompleteProfile.Text        = Model.CompleteMyFullProfileText.Rendered;
            hypCompleteProfile.NavigateUrl = MyProfileStepOneItem.GetCompleteMyProfileStepOne().GetUrl();

            //validators
            valGender.ErrorMessage = DictionaryConstants.TellGenderofChildText;
            Page.ClientScript.RegisterExpandoAttribute(valGender.ClientID, "groupName", uxBoy.GroupName);

            valNickname.ErrorMessage = DictionaryConstants.GiveChildNicknameText;
            valGrade.ErrorMessage    = DictionaryConstants.GiveChildGradeText;

            if (!IsPostBack)
            {
                //bind issue list
                rptIssues.DataSource = ChildIssueItem.GetIssues();
                rptIssues.DataBind();

                //bind grade list
                var grades = GradeLevelItem.GetGrades().Select(x => new ListItem(x.Name, x.ID.ToString()));
                ddlGrades.DataSource     = grades;
                ddlGrades.DataTextField  = "Text";
                ddlGrades.DataValueField = "Value";
                ddlGrades.DataBind();

                ddlGrades.Items.Insert(0, new ListItem()
                {
                    Text = Model.Gradedefaultselection.Rendered, Value = string.Empty, Selected = true
                });
            }
        }
        protected void DoSetup()
        {
            //cast to ListItem so we can better map over fields for name/value
            var grades = GradeLevelItem.GetGrades().Select(x => new ListItem(x.Name, x.ID.ToString()));

            uxSelectGrade.DataSource     = grades;
            uxSelectGrade.DataTextField  = "Text";
            uxSelectGrade.DataValueField = "Value";
            uxSelectGrade.DataBind();

            uxSelectGrade.Items.Insert(0, new ListItem()
            {
                Text = context.SelectGradeText, Value = string.Empty, Selected = true
            });

            switch (status)
            {
            case Constants.QueryStrings.Registration.ModeEdit:
                this.SetupChildEdit();
                litGenderGradeQuestion.Text = string.Format(context.GenderQuestionAText, singleChild.Nickname, singleChild.Gender);
                uxGender.Visible            = false;

                break;

            case Constants.QueryStrings.Registration.ModeAdd:
                this.SetupChildAdd();
                litGenderGradeQuestion.Text = context.GenderQuestionBText;

                break;

            default:
                this.SetupCompleteMyProfile();

                break;
            }

            NextButton.Text = NextButtonText;

            uxIssues.DataSource = ChildIssueItem.GetIssues();
            uxIssues.DataBind();

            uxTroubleAreasTitle.Text = Model.TroubleAreasQuestionTitle.Rendered.Replace("$pronoun$", pronoun);
            uxEvaluatedTitle.Text    = Model.FormallyEvaluatedQuestionTitle.Rendered.Replace("$pronoun$", pronoun);



            //set validation
            valGender.ErrorMessage = DictionaryConstants.TellGenderofChildText;
            Page.ClientScript.RegisterExpandoAttribute(valGender.ClientID, "groupName", uxBoy.GroupName);

            valEvalStatus.ErrorMessage = DictionaryConstants.HasChildBeenEvaluatedText;
            Page.ClientScript.RegisterExpandoAttribute(valEvalStatus.ClientID, "groupName", q2a1.GroupName);

            valNickname.ErrorMessage = DictionaryConstants.GiveChildNicknameText;
            valGrade.ErrorMessage    = DictionaryConstants.GiveChildGradeText;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            NextButton.Text = NextButtonText;

            FlushRegisteringUser();
            this.registeringUser = new Member();

            var gradeList = new List <ListItem>();

            foreach (var grade in GradeLevelItem.GetGrades())
            {
                gradeList.Add(new ListItem()
                {
                    Text = grade.Name.Raw, Value = grade.ID.ToString()
                });
            }

            uxSelectGrade1.Items.AddRange(gradeList.ToArray());
            uxSelectGrade1.DataBind();
            uxSelectGrade1.Items.Insert(0, new ListItem(DictionaryConstants.SelectGradeLabel, string.Empty));

            uxSelectGrade2.Items.AddRange(gradeList.ToArray());
            uxSelectGrade2.DataBind();
            uxSelectGrade2.Items.Insert(0, new ListItem(DictionaryConstants.SelectGradeLabel, string.Empty));

            uxSelectGrade3.Items.AddRange(gradeList.ToArray());
            uxSelectGrade3.DataBind();
            uxSelectGrade3.Items.Insert(0, new ListItem(DictionaryConstants.SelectGradeLabel, string.Empty));

            uxSelectGrade4.Items.AddRange(gradeList.ToArray());
            uxSelectGrade4.DataBind();
            uxSelectGrade4.Items.Insert(0, new ListItem(DictionaryConstants.SelectGradeLabel, string.Empty));

            uxSelectGrade5.Items.AddRange(gradeList.ToArray());
            uxSelectGrade5.DataBind();
            uxSelectGrade5.Items.Insert(0, new ListItem(DictionaryConstants.SelectGradeLabel, string.Empty));

            uxSelectGrade6.Items.AddRange(gradeList.ToArray());
            uxSelectGrade6.DataBind();
            uxSelectGrade6.Items.Insert(0, new ListItem(DictionaryConstants.SelectGradeLabel, string.Empty));
        }