Am currently working on my end of semester project (online examination system )where questions are to be obtained from a database. The question is displayed in a label and the four options in radiobuttons.. this form has 3 buttons that can enable a user to navigate to the next question,previuos question(s) and another to intentionally end the exam.whenever a user clicks on the back button of the form to access a previously answered question,the previous question is shown but the radio button that was checked as the answer is not checked.Any idea on how can i maintain the checked status for the previously answered questions?

Recommended Answers

All 8 Replies

Keep the answers in database or Session

can you store the test data in a cookie and write the buttons with an if statement? Similar to my post on this page?

http://www.daniweb.com/forums/thread227757.html

If you collect the answers in a cookie as you go, you should be able to redirect based on the cookie parameter. So if the cookie parameter is something like "if cookie[question4] is null or empty then redirect to question 3" ??? This would also allow the user to skip a question and go back to it at anytime with a little more logic.

Thanks 4 ur help... i ll try out using cookies...
thr is one more smaal issue... I am using radiobuttons for d answer options in a contentplaceholder and the size n shape they are taking is as shown in the attachment.It looks ugly this way. I want d normal radiobuttons. Why do they look lik this??? :(

Can you post your code?

<%@ Page Language="C#" MasterPageFile="~/PL/MasterPage2.master" AutoEventWireup="true" CodeFile="../BL/TestQues.aspx.cs" Inherits="PL_TestQues" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <table style="width: 540px; height: 137px">
    
        <tr>
            <td colspan="4" style="font-weight: bold">
                Question
                <asp:Label ID="lblNo" runat="server" Font-Bold="True"></asp:Label>
                of
                <asp:Label ID="lblTotalNo" runat="server" Font-Bold="True"></asp:Label><br />
                <br />
                <asp:Label ID="lblQues" runat="server" Font-Bold="True" Font-Names="Verdana" Font-Size="Small" ></asp:Label>
                <br />
                <br />
                <br />
            </td>
        </tr>
         <tr>
            <td colspan="4" rowspan="2" style="height: 175px">
                <br />
                <br />
                <br />
                <br />
               
                 <asp:RadioButton ID="rbtA" runat="server" GroupName = "grpAns"  Font-Names="Verdana" ForeColor="Black" TabIndex="1"  /><br />
                    <br />
                    <br />
                 <asp:RadioButton ID="rbtB" runat="server" GroupName = "grpAns"  Font-Names="Verdana" ForeColor="Black" Tabndex = "1" />
                    <br />
                    <br />
                 <asp:RadioButton ID="rbtC" runat="server" GroupName = "grpAns"  Font-Names="Verdana" ForeColor="Black" TabIndex="1"  />
                    <br />
                    <br />
                 <asp:RadioButton ID="rbtD" runat="server" GroupName = "grpAns"  Font-Names="Verdana" ForeColor="Black" TabIndex="1"  />
               
                <br />
                <br />
                <br />
                <br />
                <br />
                <br />
                <br />
                <br />
                <br />
                <br />
               
                
                
               
                <br />
            </td>
        </tr> 
        <tr>
        </tr>
        <tr>
            <td colspan="3" rowspan="1" style="width: 350px; height: 37px">
                <asp:Button ID="btnPrev" runat="server" Text="PREVIOUS" OnClick="btnPrev_Click" BackColor="Gray" Font-Bold="True" ForeColor="White" Height="37px" Width="174px"  /></td>
            <td colspan="1" rowspan="1" style="width: 3px; height: 37px">
                <asp:Button ID="btnNext" runat="server" OnClick="btnNext_Click" Text="NEXT" BackColor="Gray" BorderColor="#E3B333" Font-Bold="True" ForeColor="White" Height="38px" Width="164px" /></td>
        </tr>
    </table>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder3" Runat="Server">
</asp:Content>

Please help!!! It is urgent...

sir good afternoon.plz help me, how randomly taking two questions from each five groups or catogory ?Total question should be ten.what is the code?

1. Load the questions into an array.

2. Call a random number generator (http://us2.php.net/rand) to select questions from the array.

3. As each question is selected, load the selected questions into a separate array.

4. Each time the random number generator is called, check the "selected questions" array to see if that question has already been used. If so, go back to Step 2 to select another question.

Repeat until the desired number of questions have been selected.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.