April 7th, 2013, 11:32 AM
How to compare user answer with correct answer
Well, first of all i have 2 tables on database. One is Questions (QuestionID, Description, correctAnswer, userAnswer) and the other is Choices (ChoiceID, QuestionID, ChoiceText, ChoiceValue). I have connected dynamically a DetailsView so the questions are shown there and i have a RadiobuttonList databound to answers. That works perfect. I mean every time question changes, the choices are changing too based on QuestionID. Every time user clicks on a radiobutton, automatically his choice is being stored in db. Every time he goes back and forth he can check and change his previous choice. My problem is that i want to check every userAnswer if they match with correctAnswer. There will be a button on page that will do that comparison and if they match ...... do something.. if not... somethingelse. userAnswers are going to default (1st choice) every time user is loading the quiz.
I think i descibe it with more details so you know what kind of help do i need.
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.