Survey Viewer Web Control


This web control will help you to view the survey to the end users to answer it. The web control will collect the user answer for the questions and generate a final XML definition of the response which can be later saved to a physical file or in the application database.

The web control will handle the survey settings, rules, validations applied during the user answers. This includes checking if the question is mandatory or not, validating the branching and skip logic according to the user answers, handling save and resume if enabled and finally collecting the user answers to the questions.

The following is a sample definition for the web control:

<Zodiac:SurveyViewerWebControl ID="ucViewer" runat="server"
                               CssClass="bluesky"
                               XmlFilePath="c:\surveys\sample.xml"
                               OutputFolder="c:\responses\">
</Zodiac:SurveyViewerWebControl>

The web control will need default CSS style sheet "viewer.css" to be included in the web page that contains the Survey Viewer Web Control. This is required for a proper rendering of the web control.

<link type="text/css" rel="Stylesheet" href="css/viewer.css"/>

In the code behind, you need to add the following lines to "Page_Load" event of the web page to bind the survey data to the web control:

if(!IsPostBack)
{
   this.ucViewer.DataBind(); 
}

You can also bind the survey dynamically to the web control by setting the properties in the code behind instead of setting it in the markup. The sample below show how you can set the web control properties on the code behind:

if(!IsPostBack)
{
   this.ucViewer.XmlFilePath = “surveys\sample.xml”;
   this.ucViewer.OutputFolder = “responses”;
   this.ucViewer.DataBind(); 
}

See Also