Loading an unfinished questionnaire from a database

V

Vili

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
 
G

Guest

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>)...
 
V

Vili

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top