Engage.Survey.Entities.Survey.RenderSurvey C# (CSharp) Method

RenderSurvey() public static method

Static mechanism to render a survey.
public static RenderSurvey ( ISurvey survey, PlaceHolder placeHolder, bool readOnly, bool showRequiredNotation, ValidationProviderBase validationProvider, ILocalizer localizer ) : void
survey ISurvey The survey.
placeHolder PlaceHolder The place holder.
readOnly bool if set to true [read only].
showRequiredNotation bool if set to true [show required notation].
validationProvider ValidationProviderBase The validation provider.
localizer ILocalizer Localizes text.
return void
        public static void RenderSurvey(ISurvey survey, PlaceHolder placeHolder, bool readOnly, bool showRequiredNotation, ValidationProviderBase validationProvider, ILocalizer localizer)
        {
            Debug.Assert(placeHolder != null, "placeHolder cannot be null");
            Debug.Assert(validationProvider != null, "validationProvider cannot be null");

            // add the survey title
            if (survey.ShowText)
            {
                var titleDiv = new HtmlGenericControl("DIV");
                titleDiv.Attributes["class"] = Utility.CssClassSurveyTitle;
                titleDiv.InnerText = survey.Text;
                placeHolder.Controls.Add(titleDiv);
            }

            List<ISection> sections = survey.GetSections();
            foreach (ISection s in sections)
            {
                s.Render(placeHolder, readOnly, showRequiredNotation, validationProvider, localizer);
            }
        }

Usage Example

 /// <summary>
 /// Renders the survey from this survey.
 /// </summary>
 /// <param name="placeHolder">The place holder.</param>
 /// <param name="readOnly">if set to <c>true</c> [read only].</param>
 /// <param name="showRequiredNotation">if set to <c>true</c> [show required notation].</param>
 /// <param name="validationProvider">The validation provider.</param>
 /// <param name="localizer">Localizes text.</param>
 public void Render(PlaceHolder placeHolder, bool readOnly, bool showRequiredNotation, ValidationProviderBase validationProvider, ILocalizer localizer)
 {
     Survey.RenderSurvey(this, placeHolder, readOnly, showRequiredNotation, validationProvider, localizer);
 }