What I did was an exam system. I did this. I used a Datalist to bind a table, and put four Radiobuttons in the table to bind the four answers in the database. Now the question is: for example The user selects the answer of A, so how to take out the answer of A directly and compare it with the correct answer stored in the database? The younger brother is talented, please look at it, and help solve this problem
I have encountered similar problems before:
If you choose an option and compare it with the correct answer in the database, it will undoubtedly cause a page refresh problem. My solution is to use Ajax, and the user submits the data after selecting the answer. This effect may be better
You query the database, and when you generate the test questions, you store the answers in the data, and later, when you want to score, this is achieved:
if (Aswer [i] == Rad.SelectValue)
{
TotalCourseNum = TotalCourseNum + 2; // Bonus points!
}
The method of using AJAX is better, it does not refresh the page, and does not leak the answer. The method upstairs, as long as you check the page code, you can see all the answers