Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

ASP.Net Quiz, pass radiobutton selection between pages

  • 08-03-2012 10:03AM
    #1
    Registered Users, Registered Users 2 Posts: 1,539 ✭✭✭


    Im creating a simple quiz using ASP.Net,
    I have a few pages with questions, created using a radiobuttonlist, with the answers created using an arraylist.
    Then on the last page i have a score total.
    I was wondering how i can retrieve the selectedindex of the arraylist and compare it to the correct answers, and if correct a score will be added.

    Also theres a home page, with just a start quiz button, upon entering page 2, i would like a timer to start, and when the user gets to page 7, the timer stops, and a label shows the time taken.

    any help appreciated thanks.


Comments

  • Registered Users, Registered Users 2 Posts: 2,793 ✭✭✭John_Mc


    mcw92 wrote: »
    Im creating a simple quiz using ASP.Net,
    I have a few pages with questions, created using a radiobuttonlist, with the answers created using an arraylist.
    Then on the last page i have a score total.
    I was wondering how i can retrieve the selectedindex of the arraylist and compare it to the correct answers, and if correct a score will be added.

    Also theres a home page, with just a start quiz button, upon entering page 2, i would like a timer to start, and when the user gets to page 7, the timer stops, and a label shows the time taken.

    any help appreciated thanks.

    Are the questions fixed or are they randomly selected on page load?

    You could use a session object to store the answers given and compute the final score on the results page by iterating through the session object and comparing the answer given to the correct answer.

    A Dictionary<int,int> which has the question number as the key, and the selected index of the answer as the value would work nicely.

    As for the timer, there are plenty of jQuery timers available


Advertisement