/// <summary>
        /// Set the forms to match DB question options
        /// </summary>
        private void BindQuestionOptions()
        {
            // Retrieve the original question values
            QuestionData question = new Questions().GetQuestionById(_parentQuestionId, LanguagesDropdownlist.SelectedValue);

            QuestionData.QuestionsRow questionRow = question.Questions[0];
            QuestionExtraLinks1.Initialize(questionRow.SurveyId, questionRow.QuestionId, questionRow.DisplayOrder, questionRow.PageNumber);
            //
            // Assign them to the form
            QuestionFreeTextBox.Text = questionRow.QuestionText;
            MinSelectionDropDownList.SelectedValue =
                (questionRow.IsMinSelectionRequiredNull()) ? "0" : questionRow.MinSelectionRequired.ToString();
            MaxAllowedDropDownList.SelectedValue =
                (questionRow.IsMaxSelectionAllowedNull()) ? "0" : questionRow.MaxSelectionAllowed.ToString();

            MultipleChoiceCheckbox.Checked = questionRow.SelectionModeId == (int)QuestionSelectionMode.MultiMatrix;
            RatingCheckbox.Checked         = questionRow.RatingEnabled;
            ViewState["LibrayID"]          = questionRow.IsLibraryIdNull() ? -1 : questionRow.LibraryId;

            if (!questionRow.IsLibraryIdNull() && !NSurveyUser.Identity.IsAdmin)
            {
                CheckRight(NSurveyRights.ManageLibrary, true);
            }

            QuestionSectionOptionData sectionOptions = new Questions().GetQuestionSectionOptions(_parentQuestionId, LanguagesDropdownlist.SelectedValue);

            if (sectionOptions.QuestionSectionOptions.Rows.Count > 0)
            {
                RepeatSectionCheckbox.Checked          = true;
                RepeatSectionOptionPlaceholder.Visible = true;
                AddSectionLinkTextBox.Text             = sectionOptions.QuestionSectionOptions[0].AddSectionLinkText;
                DeleteSectionLinkTextBox.Text          = sectionOptions.QuestionSectionOptions[0].DeleteSectionLinkText;
            }
            else
            {
                RepeatSectionCheckbox.Checked          = false;
                RepeatSectionOptionPlaceholder.Visible = false;
            }


            RatingCheckbox.Checked = questionRow.RatingEnabled;

            EnableDisableGroupFields(RatingCheckbox.Checked);
            BindQuestionGroups();

            txtQuestionID.Text      = questionRow.QuestionIdText;
            txtAlias.Text           = questionRow.Alias;
            txtHelpText.Text        = questionRow.HelpText;
            chbShowHelpText.Checked = (questionRow.ShowHelpText != null) ? (bool)questionRow.ShowHelpText : false;
        }
예제 #2
0
        /// <summary>
        /// Set the forms to match DB question options
        /// </summary>
        private void BindQuestionOptions()
        {
            // Retrieve the original question values
            QuestionData question = new Questions().GetQuestionById(_questionId, LanguagesDropdownlist.SelectedValue);

            QuestionData.QuestionsRow questionRow = question.Questions[0];

            QuestionExtraLinks1.Initialize(questionRow.SurveyId, questionRow.QuestionId, questionRow.DisplayOrder, questionRow.PageNumber);

            // Assign them to the form
            QuestionFreeTextBox.Text = questionRow.QuestionText;
            txtQuestionID.Text       = questionRow.QuestionIdText;
            DisplayModeDropDownList.SelectedValue =
                (questionRow.IsLayoutModeIdNull()) ? ((int)QuestionLayoutMode.Horizontal).ToString() : questionRow.LayoutModeId.ToString();
            ColumnDropdownlist.SelectedValue        = questionRow.ColumnsNumber.ToString();
            SelectionModeDropDownList.SelectedValue = questionRow.SelectionModeId.ToString();
            MinSelectionDropDownList.SelectedValue  =
                (questionRow.IsMinSelectionRequiredNull()) ? "0" : questionRow.MinSelectionRequired.ToString();
            MaxAllowedDropDownList.SelectedValue =
                (questionRow.IsMaxSelectionAllowedNull()) ? "0" : questionRow.MaxSelectionAllowed.ToString();

            //JL: Enable or disable the Min Max dropdown list depending on selectionmodedropdownlist option selected by user
            EnableDisableMinMaxDropDownList();

            RandomizeCheckBox.Checked = questionRow.RandomizeAnswers;
            RatingCheckbox.Checked    = questionRow.RatingEnabled;

            RatingCheckbox.Checked = questionRow.RatingEnabled;

            EnableDisableGroupFields(RatingCheckbox.Checked);
            BindQuestionGroups();

            PipeAliasTextBox.Text     = questionRow.QuestionPipeAlias;
            RandomizeCheckBox.Enabled = !RatingCheckbox.Checked;

            ViewState["LibraryId"] = questionRow.IsLibraryIdNull() ? -1 : questionRow.LibraryId;
            if (!questionRow.IsLibraryIdNull() && !NSurveyUser.Identity.IsAdmin)
            {
                CheckRight(NSurveyRights.ManageLibrary, true);
            }

            // Can the question have answers
            if (((QuestionTypeMode)questionRow.TypeMode & QuestionTypeMode.Answerable) > 0)
            {
                AnswerOptionsPlaceholder.Visible       = true;
                RepeatSectionOptionPlaceHolder.Visible = true;
                EditAnswersButton.Enabled = true;
                MultipleSelection         = ((QuestionTypeMode)questionRow.TypeMode & QuestionTypeMode.MultipleAnswers) > 0;
            }
            else
            {
                RepeatSectionOptionPlaceHolder.Visible = false;
                AnswerOptionsPlaceholder.Visible       = false;
                EditAnswersButton.Enabled = false;
                new Question().DeleteQuestionSectionOptions(_questionId);
            }

            if (questionRow.RatingEnabled)
            {
                BindQuestionGroups();
            }
            else
            {
                ddlGroup.Enabled    = true;
                ddlSubGroup.Enabled = true;
            }

            txtAlias.Text           = questionRow.Alias;
            txtHelpText.Text        = questionRow.HelpText;
            chbShowHelpText.Checked = (questionRow.ShowHelpText) ? (bool)questionRow.ShowHelpText : false;
        }