コード例 #1
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            Page.ClientScript.RegisterClientScriptInclude("TinyMce", ResolveClientUrl("~/Scripts/tiny_mce/tiny_mce.js"));
            Page.ClientScript.RegisterClientScriptInclude("ComposerScripts", ResolveClientUrl("~/Scripts/QuestionComposerScripts.js"));

            if (_question != null)
            {
                _questionContentTextBox.Text = _question.Content;
                _isVisibleCheckbox.Checked   = _question.IsVisible;

                for (int i = 0; i < _question.QuestionAnswers.Count; ++i)
                {
                    var control = new QuestionAnswerControl()
                    {
                        AnswerLabelText   = AnswerLabelText,
                        AnswerContent     = _question.QuestionAnswers.ElementAt(i).Content,
                        FractionLabelText = FractionLabelText,
                        FractionValue     = _question.QuestionAnswers.ElementAt(i).Fraction.ToString()
                    };

                    _answerControls.Add(control);
                    Controls.Add(control);
                    Controls.Add(new LiteralControl("<br>"));
                }
            }
            else
            {
                for (int i = 0; i < AnswerCount; ++i)
                {
                    var control = new QuestionAnswerControl()
                    {
                        AnswerLabelText   = AnswerLabelText,
                        FractionLabelText = FractionLabelText
                    };

                    _answerControls.Add(control);
                    Controls.Add(control);
                    Controls.Add(new LiteralControl("<br>"));
                }
            }

            BindFractionDropDowns();

            Controls.Add(_validator);
        }
コード例 #2
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load" /> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs" /> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            Page.ClientScript.RegisterClientScriptInclude("TinyMce", ResolveClientUrl("~/Scripts/tiny_mce/tiny_mce.js"));
            Page.ClientScript.RegisterClientScriptInclude("ComposerScripts", ResolveClientUrl("~/Scripts/QuestionComposerScripts.js"));

            if (_question != null)
            {
                _questionContentTextBox.Text = _question.Content;
                _isVisibleCheckbox.Checked = _question.IsVisible;

                for (int i = 0; i < _question.QuestionAnswers.Count; ++i)
                {
                    var control = new QuestionAnswerControl()
                    {
                        AnswerLabelText = AnswerLabelText,
                        AnswerContent = _question.QuestionAnswers.ElementAt(i).Content,
                        FractionLabelText = FractionLabelText,
                        FractionValue = _question.QuestionAnswers.ElementAt(i).Fraction.ToString()
                    };

                    _answerControls.Add(control);
                    Controls.Add(control);
                    Controls.Add(new LiteralControl("<br>"));
                }
            }
            else
            {
                for (int i = 0; i < AnswerCount; ++i)
                {
                    var control = new QuestionAnswerControl()
                    {
                        AnswerLabelText = AnswerLabelText,
                        FractionLabelText = FractionLabelText
                    };

                    _answerControls.Add(control);
                    Controls.Add(control);
                    Controls.Add(new LiteralControl("<br>"));
                }
            }

            BindFractionDropDowns();

            Controls.Add(_validator);
        }