Example #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;
        }