Пример #1
0
        /// <summary>
        /// Handles the ItemDataBound event of the rQuestions control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RepeaterItemEventArgs"/> instance containing the event data.</param>
        protected void rQuestions_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var assessmentResponseRow       = e.Item.DataItem as AssessmentResponse;
            RockRadioButtonList rblQuestion = e.Item.FindControl("rblQuestion") as RockRadioButtonList;

            if (assessmentResponseRow.Code.EndsWith("N"))
            {
                rblQuestion.DataSource = _negativeOption;
            }
            else
            {
                rblQuestion.DataSource = _positiveOption;
            }

            rblQuestion.DataTextField  = "Value";
            rblQuestion.DataValueField = "Key";
            rblQuestion.DataBind();

            rblQuestion.Label = assessmentResponseRow.Question;

            if (assessmentResponseRow != null && assessmentResponseRow.Response.HasValue)
            {
                rblQuestion.SetValue(assessmentResponseRow.Response);
            }
            else
            {
                rblQuestion.SetValue(string.Empty);
            }
        }
Пример #2
0
        /// <summary>
        /// Handles the ItemDataBound event of the rQuestions control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="RepeaterItemEventArgs"/> instance containing the event data.</param>
        protected void rQuestions_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var assessmentResponseRow       = e.Item.DataItem as AssessmentResponse;
            RockRadioButtonList rblQuestion = e.Item.FindControl("rblQuestion") as RockRadioButtonList;

            if (assessmentResponseRow.OptionType == MotivatorService.OptionType.Frequency)
            {
                rblQuestion.DataSource = MotivatorService.Frequency_Option;
            }
            else
            {
                rblQuestion.DataSource = MotivatorService.Agreement_Option;
            }

            rblQuestion.DataTextField = "Name";

            if (assessmentResponseRow.Code.EndsWith("N"))
            {
                rblQuestion.DataValueField = "Negative";
            }
            else
            {
                rblQuestion.DataValueField = "Positive";
            }

            rblQuestion.DataBind();

            rblQuestion.Label = assessmentResponseRow.Question;

            if (assessmentResponseRow != null && assessmentResponseRow.Response.HasValue)
            {
                rblQuestion.SetValue(assessmentResponseRow.Response);
            }
            else
            {
                rblQuestion.SetValue(string.Empty);
            }
        }