Dynamic Data Loading

ZSURVEY provide the ability to bind the survey data direct to the web controls without using XML files. The Survey Builder Web Control can bind the XML definition of the survey on the fly and load the pages, questions, branching rules and media files of the survey without using any physical files.

The sample below show how to bind the survey XML to the Survey Builder Web Control.

private string xml = @"<survey version='1.2'>
                                <title>Sample Survey</title>
                                <description>This is a sample survey description</description>
                                <endtitle>Thank You</endtitle>
                                <enddescription>Thank you for taking this survey</enddescription>
                                <page id='1' title='Start Page' 
                                             description='This is a sample start page' />
                                <question id='1' type='singlechoice' page='1'>
                                  <body>What is your gender?</body>
                                  <media />
                                  <rules />

    protected override void OnInit(EventArgs e)
        // Register OnSaveSurvey event
        this.ucSurveyBuilderWebControl.OnSaveSurvey += new 


    protected void Page_Load(object sender, EventArgs e)
        if (!IsPostBack)
            // Set the XML definition of the survey. This XML can be retrieved from the database.
            this.ucSurveyBuilderWebControl.Xml = xml;           

    protected void ucSurveyBuilderWebControl_OnSaveSurvey(object sender, SurveyArgs args)
        // Receive the new XML definition of the survey after save
        string surveyXml = args.Xml;

        // TODO: surveyXml string to be saved on the database

See Also