By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,876 Members | 1,239 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,876 IT Pros & Developers. It's quick & easy.

Loading an unfinished questionnaire from a database

P: n/a
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

Apr 29 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Apr 29, 2:34 pm, Vili <enha...@spammia.fiwrote:
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>)...

Apr 30 '07 #2

P: n/a
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>)...

Apr 30 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.