Exemplo n.º 1
0
        protected override void OnLoad(EventArgs e)
        {
            if (!(Page.IsPostBack))
            {
                CreateQuestionTypeEntries();
                CreateRepeatDirectionEntries();
                CreateChartTypeEntries();

                CorrectAnswerPanel.Visible = (SurveyType == SurveyType.Quiz);

                if (SurveyID > 0)
                {
                    Survey  = SurveysController.Get(SurveyID);
                    Answers = SurveyOptionsController.GetAll(SurveyID);
                    QuestionTextBox.Text = Survey.Question;
                    QuestionTypeDropDownList.SelectedValue = Convert.ToInt32(Survey.OptionType).ToString();
                    ChartTypeDropDownList.SelectedValue    = Convert.ToInt32(Survey.ChartType).ToString();
                    IsStatisticalCheckBox.Checked          = (Survey.IsStatistical.HasValue ? Survey.IsStatistical.Value : false);
                    if (Survey.OptionType == QuestionType.RadioButtons || Survey.OptionType == QuestionType.CheckBoxes)
                    {
                        RepeatDirectionDropDownList.SelectedValue = Convert.ToInt32(Survey.RepeatDirection).ToString();
                        RepeatColumnsTextBox.Text = Survey.RepeatColumns.ToString();
                    }
                    else
                    {
                        NumberOfRowsTextBox.Text      = Survey.NumberOfRows.ToString();
                        IsStatisticalCheckBox.Enabled = false;
                        RepeatDirectionPanel.Visible  = false;
                        AnswersPanel.Visible          = false;
                        TextAnswerPanel.Visible       = true;
                    }
                    AnswersGrid.DataSource = Answers;
                    AnswersGrid.DataBind();
                    MaxViewOrder     = Answers.Count;
                    ChartTypeChanged = true;
                }
                if (SurveyType == SurveyType.Quiz)
                {
                    IsStatisticalPanel.Visible = true;
                }
            }
        }