Results 1 to 9 of 9

Thread: Online questionnaire

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Feb 2006
    Posts
    275

    Online questionnaire

    Hi

    I have seen online tests,online questionnaire. I have to ask that on what basis these are designed.
    I know that the questions are stored in a database but how they are shown on the form. I mean that do controls are created on runtime or there is some other technique.
    If controls like labels are designed on runtime then how their positions are maintained.
    For example if there are 50 questions no body takes this task to create labels on forms and assign their positions on the form.
    Also if there are MCQ's then how they are placed from the database
    Please tell me that how this task is done

    Thank You
    A. Haider

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Online questionnaire

    I'm sure each one has their own style.

    If I knew I had 50 questions, and would never have more than, or less than, 50 questions, I would individual create all the controls and labels necessary to display them and record the responses.

  3. #3
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Online questionnaire

    We have our database control each "control" on the form - position - size - names - and so on.

    They are each "cloned" from a (0) control array element on our form - at runtime.

    This makes it very easy to have "extensible" forms - where the number of form controls varies from run experience to run experience.

    But still allows you to have single events that fire in relationship to these controls - as they are all in control arrays.

    btw - we have had issues with OPTION BUTTONS - they are a pain to create a runtime - setting certain ones to "true" causes events to backup and fire at the start of the form in a strange way.

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  4. #4
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: Online questionnaire

    I would go with a dynamic approach. Create a class / control that is basically called "Question" or something like that. Then you would dynamically create them depending on how many questions there are in the database.

    Quote Originally Posted by Hack
    If I knew I had 50 questions, and would never have more than, or less than, 50 questions, I would individual create all the controls and labels necessary to display them and record the responses.
    Sorry but this is a bad approach regardless if there are 50 questions and would never have more or less. What happens if someone wants to update a question? You'd have to re-deploy code rather than updating a database. What if a business user wants to update the questions? Do you really want to create 50 text boxes, 50 labels, etc?

    I would opt for the creating a custom control called Question. This control would have a label, a textbox, some checkboxes and some radio buttons. It would basically dynamically display these items depending on the data supplied to it. Once this control is done, it's insanely simple to iterate through each control or to add/remove them.

    By the time you finish manually adding all of these controls, I could have one of these custom controls done and you'd never need to worry again. Then you just query a database for the data.
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  5. #5
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Online questionnaire

    Quote Originally Posted by szlamany
    We have our database control each "control" on the form...
    I would also opt for database driven form layout/content - it's flexible and quite dynamic.


    Quote Originally Posted by szlamany
    btw - we have had issues with OPTION BUTTONS - they are a pain to create a runtime - setting certain ones to "true" causes events to backup and fire at the start of the form in a strange way.
    There are always plenty of "work arrounds" - raising some boolean/integer flag before setting OB value is most commonly used.

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Online questionnaire

    Quote Originally Posted by kasracer
    Sorry but this is a bad approach regardless if there are 50 questions and would never have more or less. What happens if someone wants to update a question? You'd have to re-deploy code rather than updating a database. What if a business user wants to update the questions? Do you really want to create 50 text boxes, 50 labels, etc?
    If this were a desktop application I would agree with you.

    It is an online webpage.

    Make your changes and republish it. - Done

  7. #7
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: Online questionnaire

    Quote Originally Posted by Hack
    It is an online webpage.

    Make your changes and republish it. - Done
    Again, that isn't simple for a business user to use and doesn't work well in an environment where you have to schedule deployments a week ahead of time.

    Your method will work for a small website or small company but any large organization isn't going to just let you republish the site. You'll most likely want to put it into a QA environment, test, then schedule to have it put into production. All of this can be avoided via a very simple database driven design.
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  8. #8

  9. #9
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: Online questionnaire

    I also took it to be desktop - online means so many different things to so many people...

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width