The structure of the form is
Question textbox
Choice 1 textbox radiobutton 1
Choice 2 textbox radiobutton 2
Choice 3 textbox radiobutton 3
choice 4 textbox radiobutton 4
and save button
Suppose
Question - What is the capital of India?
and its choices are
Choice 1- SriLanka
Choice 2- India
Choice 3- NewYork
Choice 4- London
the correct answer is india and its id is 2
After inserting the data in three table it will look
tblQuestion
qid Question
-------------------
1 What is the capital of India?
tblAnswerChoice
ansid qid Choice
-------------------------
1 1 SriLanka
2 1 India
3 1 NewYork
4 1 London
tblAnswer
aid qid ansid
----------------------
1 1 2
Now my problem how to show the correct answer through radio button corresponding
the answer choice.
for above example the radiobutton 2 will be checked true
but it is possible to show the correct answer through radio button and then add 1 Value in Result Database
I see a couple of options here, ASP is server side, so you are gonna run into the issue of either reloading the page, or having you answer somewhere in the code. If you are going the reload path, then you just need to have the user submit the form, either when they click the radio or with a button, something like:
Or you can go the javascript route, and put the answer in the page with:
Code:
content = "<script language=javascript> function CheckAnswer(a){
if(a == 2){ alert("You are correct"); }
}</script>
Now its not all that simple, you have to work out the details, but that is gist of it. If you are testing people for some other reason than fun, I would go the ASP route and load a result page with something like "Yeah your correct" or "Nope try again", or however you want to put it to them. The ASP route just means you can't open the source of the page and cheat. There are a few other, more complicated ways to do this with java, but why when all it costs you is page load. Post up if you need more help.
actually i am using visual studion 2008 and there i am building an online examination system for that i am using this, and there im also using Database so pls guid me in that point of VIEW
thanks
Bookmarks