Newbie: Datagrid with 2 tables

@

^^@++

Hi guys,
I'm still having trouble with my questionnaire web site. Anyone know
of a questionnaire code example anywhere?

To start with I'll have 2 tables - Questions and Answers.

Questions = QuestionID, QuestionNumber, QuestionText, Answers
1 1 What's your name? null
2 1a, Sex
Male/Female
3 1b Age
0-20/20-30/30+


Answers = QuestionID, UserID, Answer
1 37 Matt F
2 37 Male
3 37 20-30
1 38 Steve
...


So, my web page needs to read the questions from the DB, display them,
and then write the answers to the answer table. Sounds simple to me.

In the Questions table, when the Answers field is null, a Textbox
needs to be displayed for their answer. When Answer is not null, I'll
display a DropDownList with the available answers.

So, my questions.

1. Is this possible with a DataRepeater or DataGrid? (Bear in mind my
DropDownList requirement)
2. Is the correct approach to fill a DataSet with the rows from the
Question table and bind that to a DataGrid? Then have a submit button,
which when clicked creates an Answers DataSet which is merged in?

Hopefully I've got this right, but I can't find any code which does
what I've described which leads me to question my approach. I have
Esposito's ASP.NET but the examples in there all seem to be displaying
and updating data from one table.

Thanks for any advice
-Matt
 

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,995
Messages
2,570,236
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top