예제 #1
0
        private void RenderQuestions()
        {
            IQuestion control = null;
            Collection <QuestionOption> options;

            foreach (Question question in questions)
            {
                switch ((QuestionType)question.QuestionTypeId)
                {
                case QuestionType.TextBox:
                    control = new TextBoxQuestion(question);
                    break;

                case QuestionType.DropDownList:
                    options = QuestionOption.GetAll(question.QuestionGuid);
                    control = new DropDownListQuestion(question, options);
                    break;

                case QuestionType.RadioButtonList:
                    options = QuestionOption.GetAll(question.QuestionGuid);
                    control = new RadioButtonListQuestion(question, options);
                    break;

                case QuestionType.CheckBoxList:
                    options = QuestionOption.GetAll(question.QuestionGuid);
                    control = new CheckBoxListQuestion(question, options);
                    break;

                case QuestionType.Date:
                    control = new DateQuestion(question);
                    break;

                default:
                    throw new ArgumentException("Invalid question type");
                }

                PopulateAnswer(control);

                FormGroupPanel row = new FormGroupPanel
                {
                    CssClass = "settingrow"
                };

                row.Controls.Add((CompositeControl)control);

                pnlQuestions.Controls.Add(row);
            }
        }
예제 #2
0
        private void RenderQuestions()
        {
            IQuestion control = null;
            Collection <QuestionOption> options;

            foreach (Question question in questions)
            {
                switch ((QuestionType)question.QuestionTypeId)
                {
                case QuestionType.TextBox:
                    control = new TextBoxQuestion(question);
                    break;

                case QuestionType.DropDownList:
                    options = QuestionOption.GetAll(question.QuestionGuid);
                    control = new DropDownListQuestion(question, options);
                    break;

                case QuestionType.RadioButtonList:
                    options = QuestionOption.GetAll(question.QuestionGuid);
                    control = new RadioButtonListQuestion(question, options);
                    break;

                case QuestionType.CheckBoxList:
                    options = QuestionOption.GetAll(question.QuestionGuid);
                    control = new CheckBoxListQuestion(question, options);
                    break;

                case QuestionType.Date:
                    control = new DateQuestion(question);
                    break;

                default:
                    throw new ArgumentException("Invalid question type");
                }

                PopulateAnswer(control);

                HtmlGenericControl row    = new HtmlGenericControl("div");
                HtmlGenericControl spacer = new HtmlGenericControl("div");
                row.Attributes.Add("class", "settingrow");
                spacer.Attributes.Add("class", "clearpanel");
                row.Controls.Add((CompositeControl)control);

                pnlQuestions.Controls.Add(row);
                pnlQuestions.Controls.Add(spacer);
            }
        }
예제 #3
0
        private void RenderQuestions()
        {
            IQuestion control = null;
            Collection<QuestionOption> options;

            foreach (Question question in questions)
            {
                switch ((QuestionType)question.QuestionTypeId)
                {
                    case QuestionType.TextBox:
                        control = new TextBoxQuestion(question);
                        break;
                    case QuestionType.DropDownList:
                        options = QuestionOption.GetAll(question.QuestionGuid);
                        control = new DropDownListQuestion(question, options);
                        break;
                    case QuestionType.RadioButtonList:
                        options = QuestionOption.GetAll(question.QuestionGuid);
                        control = new RadioButtonListQuestion(question, options);
                        break;
                    case QuestionType.CheckBoxList:
                        options = QuestionOption.GetAll(question.QuestionGuid);
                        control = new CheckBoxListQuestion(question, options);
                        break;
                    case QuestionType.Date:
                        control = new DateQuestion(question);
                        break;
                    default:
                        throw new ArgumentException("Invalid question type");
                }

                PopulateAnswer(control);

                HtmlGenericControl row = new HtmlGenericControl("div");
                HtmlGenericControl spacer = new HtmlGenericControl("div");
                row.Attributes.Add("class", "settingrow");
                spacer.Attributes.Add("class", "clearpanel");
                row.Controls.Add((CompositeControl)control);

                pnlQuestions.Controls.Add(row);
                pnlQuestions.Controls.Add(spacer);
            }
        }