Loading an unfinished questionnaire from a database

Discussion in 'ASP .Net' started by Vili, Apr 29, 2007.

  1. Vili

    Vili Guest

    Hi all

    I am having problems with creating an functional questionnaire with
    asp.net 2.0 and MSSQL 2005 database.

    I have a table with field id (key & auto int), clientId (int),
    QuestionId (int), And answer (nvarchar(255)) and a set of questions on
    an another table.

    Questions can have 0 or more answers

    so a client 10 can have the table looking like this
    Id|ClientId|QuestionId|Answer|
    1 |10 |1 |Yes |
    1 |10 |2 |Red |
    1 |10 |2 |Blue |
    1 |10 |2 |White |
    1 |10 |3 |None |
    1 |10 |10 |1000€ |
    ....

    The questionnaire is on a wizard-control and is composed of textboxes,
    checkboxlist, radiobuttonlists and other

    I have created a small class to handle the saving of data. When loading
    wizard page I tell the handler class (handlerObj) the webcontrols and
    the question id the control answers to.

    ie. handlerObj.add(FirstQuestion, 1)

    Saving the data is not a problem. I just loop the controls marked in
    handlerObj and save them to the database. Problem is how to load an
    unfinished questionnaire to the user to edit?

    If my handlerobj has a checkboxlist with questionId 5 and it has 10
    listitems to choose from.. When loading, how I set the previously
    selected items checked?

    All suggestions and ideas to solve this problem are appreciated.

    Tuomo
     
    Vili, Apr 29, 2007
    #1
    1. Advertising

  2. On Apr 29, 2:34 pm, Vili <> wrote:
    > Problem is how to load an
    > unfinished questionnaire to the user to edit?


    I think you can either enumerate the controls in the handlerObj and
    find one with the questionId 5, or you can call FindControl(<name>)...
     
    Alexey Smirnov, Apr 30, 2007
    #2
    1. Advertising

  3. Vili

    Vili Guest

    I have decided to add control id with the answer to the table

    So when reading the questions from the database I just compare the
    control id to the value from table.

    > I think you can either enumerate the controls in the handlerObj and
    > find one with the questionId 5, or you can call FindControl(<name>)...
     
    Vili, Apr 30, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex Papadimoulis

    Re: Rendering a questionnaire

    Alex Papadimoulis, Nov 14, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    319
    Adrian
    Nov 18, 2003
  2. ^^@++

    Questionnaire with DropDownList

    ^^@++, May 17, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    382
    ^^@++
    May 18, 2004
  3. Alf P. Steinbach
    Replies:
    7
    Views:
    386
    Ioannis Vranos
    Dec 22, 2004
  4. Robin

    Free source guestbook - unfinished

    Robin, Apr 20, 2004, in forum: Perl Misc
    Replies:
    4
    Views:
    1,749
    Joe Smith
    Apr 21, 2004
  5. Unfinished Loop

    , Oct 21, 2006, in forum: Javascript
    Replies:
    5
    Views:
    138
    Michael Winter
    Oct 22, 2006
Loading...

Share This Page