/// <summary> /// Get a web control instance of the question row /// and adds it with its options to the table /// </summary> private void AddQuestionWebControl(Table questionTable, QuestionData.QuestionsRow question) { QuestionItem questionWebControl = QuestionItemFactory.Create(question, LanguagesDropdownlist.SelectedValue, this.UniqueID, 0, null, true, true); // Set question's style // and bind the data Style questionStyle = new Style(); questionStyle.CssClass = "surveyQuestion"; Style answerStyle = new Style(); answerStyle.CssClass = "surveyAnswer"; //Style markStyle = new Style(); //markStyle.CssClass = "icon-warning-sign"; if (questionWebControl is ActiveQuestion) { ((ActiveQuestion)questionWebControl).EnableClientSideValidation = false; ((ActiveQuestion)questionWebControl).EnableServerSideValidation = false; ((ActiveQuestion)questionWebControl).ValidationMarkStyle.CssClass = "icon-warning-sign"; //GB } if (questionWebControl is SectionQuestion) { ((SectionQuestion)questionWebControl).SectionOptionStyle.CssClass = "questionOptions"; ((SectionQuestion)questionWebControl).ValidationMarkStyle.CssClass = "icon-warning-sign"; //GB } if (questionWebControl is MatrixQuestion) { ((MatrixQuestion)questionWebControl).MatrixHeaderStyle = answerStyle; ((MatrixQuestion)questionWebControl).MatrixItemStyle = answerStyle; ((MatrixQuestion)questionWebControl).MatrixAlternatingItemStyle = answerStyle; ((MatrixQuestion)questionWebControl).ValidationMarkStyle.CssClass = "icon-warning-sign"; //GB } questionWebControl.RenderMode = ControlRenderMode.ReadOnly; questionWebControl.AnswerStyle = answerStyle; questionWebControl.QuestionStyle = questionStyle; questions.Add(questionWebControl); // Add the question and its options to the table questionTable.Rows.Add(BuildQuestionOptionsRow(question)); if (questionWebControl is MatrixQuestion) { // questionWebControl.Width = new Unit(400.0,UnitType.Pixel); questionTable.Rows.Add(BuildRow(questionWebControl)); } else { questionTable.Rows.Add(BuildRow(questionWebControl)); } }
/// <summary> /// Get a web control instance of the question row /// and adds it with its options to the table /// </summary> private void AddQuestionWebControl(Table questionTable, QuestionData.QuestionsRow question) { QuestionItem questionWebControl = QuestionItemFactory.Create(question, LanguagesDropdownlist.SelectedValue, this.UniqueID, 0, null, true, true); // Set question's style // and bind the data Style questionStyle = new Style(); questionStyle.CssClass = "surveyQuestion"; Style answerStyle = new Style(); answerStyle.CssClass = "surveyAnswer"; Style markStyle = new Style(); if (questionWebControl is ActiveQuestion) { ((ActiveQuestion)questionWebControl).EnableClientSideValidation = false; ((ActiveQuestion)questionWebControl).EnableServerSideValidation = false; } if (questionWebControl is SectionQuestion) { ((SectionQuestion)questionWebControl).SectionOptionStyle.CssClass = "questionOptions"; } if (questionWebControl is MatrixQuestion) { ((MatrixQuestion)questionWebControl).MatrixHeaderStyle = answerStyle; ((MatrixQuestion)questionWebControl).MatrixItemStyle = answerStyle; ((MatrixQuestion)questionWebControl).MatrixAlternatingItemStyle = answerStyle; } questionWebControl.RenderMode = ControlRenderMode.ReadOnly; questionWebControl.AnswerStyle = answerStyle; questionWebControl.QuestionStyle = questionStyle; questions.Add(questionWebControl); // Add the question and its options to the table if (NSurveyUser.Identity.IsAdmin || CheckRight(NSurveyRights.ManageLibrary, false)) { questionTable.Rows.Add(BuildQuestionOptionsRow(question)); } questionTable.Rows.Add(BuildRow(questionWebControl, "")); }
/// <summary> /// Get a web control instance of the question row /// and adds it with its options to the table /// </summary> private void AddQuestionWebControl(Table questionTable, QuestionData.QuestionsRow question) { QuestionItem questionWebControl; // Set voter answers only on first load to init // question control's answer items if (!Page.IsPostBack) { questionWebControl = QuestionItemFactory.Create(question, null, this.UniqueID, 0, _voterAnswers.VotersAnswers, false); } else { questionWebControl = QuestionItemFactory.Create(question, null, this.UniqueID, 0, null, false); } // Set question's style // and bind the data Style questionStyle = new Style(); questionStyle.CssClass = "surveyQuestion"; Style answerStyle = new Style(); answerStyle.CssClass = "surveyAnswer"; Style markStyle = new Style(); Style validationStyle = new Style(); validationStyle.CssClass = "questionValidationMessageStyleCSS"; Style confirmationStyle = new Style(); confirmationStyle.CssClass = "confirmationMessageStyleCSS"; if (questionWebControl is ActiveQuestion) { ((ActiveQuestion)questionWebControl).AnswerPosted += new AnswerPostedEventHandler(OnAnswerPost); ((ActiveQuestion)questionWebControl).EnableClientSideValidation = false; ((ActiveQuestion)questionWebControl).EnableServerSideValidation = false; ((ActiveQuestion)questionWebControl).ValidationMessageStyle = validationStyle; ((ActiveQuestion)questionWebControl).ConfirmationMessageStyle = confirmationStyle; } if (questionWebControl is SectionQuestion) { ((SectionQuestion)questionWebControl).SectionOptionStyle.CssClass = "questionOptions"; } if (questionWebControl is MatrixQuestion) { ((MatrixQuestion)questionWebControl).MatrixHeaderStyle = answerStyle; ((MatrixQuestion)questionWebControl).MatrixStyle = answerStyle; ((MatrixQuestion)questionWebControl).MatrixItemStyle = answerStyle; ((MatrixQuestion)questionWebControl).MatrixAlternatingItemStyle = answerStyle; } if (questionWebControl is SectionQuestion) { ((SectionQuestion)questionWebControl).SectionGridAnswersItemStyle = answerStyle; ((SectionQuestion)questionWebControl).SectionGridAnswersHeaderStyle = answerStyle; ((SectionQuestion)questionWebControl).SectionGridAnswersAlternatingItemStyle = answerStyle; ((SectionQuestion)questionWebControl).SectionGridAnswersStyle = answerStyle; ((SectionQuestion)questionWebControl).EnableGridSectionClientSideValidation = false; ((SectionQuestion)questionWebControl).EnableGridSectionServerSideValidation = false; } questionWebControl.RenderMode = ControlRenderMode.Edit; questionWebControl.AnswerStyle = answerStyle; questionWebControl.QuestionStyle = questionStyle; questions.Add(questionWebControl); // Add the question and its options to the table questionTable.Rows.Add(BuildQuestionOptionsRow(question)); questionTable.Rows.Add(BuildRow(questionWebControl)); }