Click here to Skip to main content
15,905,229 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am developing online examination project. For that i am displaying one question on the page. After answering the question user click next button then next question will display.

My problems is how to store all the question and user selected answers temporarily in ArrayList/Datatable and show after completing test?

Please suggest me.
Posted

1 solution

Hi,

Here I gave you idea how to store user information temply

Use session variable to store data temporarly

like
C#
 DataTable dt=new DataTable();
dt.rows[0][0]="Questionid";
dt.rows[0][1]="userselected ans";
dt.rows[0][2]="correct ans";
//..
//..
Session["udata"]=dt;

//display second question


After completing all questions you can display previous information

C#
 DataTable dt=(DataTable)Session["udata"];
  Lblfrstans.Text=dt.rows[0][1].toString();
 Lblscndans.Text=dt.rows[1][1].tostring();
//..
//..


I hope you know about session creation and how to use it

All the Best
 
Share this answer
 
Comments
Ramakrishna, Eswarraju 29-Sep-11 5:28am    
I tried this way, but it is overwriting previous values.
Note: I am displaying all the questions in one page, one at a time using updatepannel.
Muralikrishna8811 29-Sep-11 5:31am    
you've to check if session is exists get datatable object
like
if(session["udata"].tostring()=="")
{
create table and assign to session
}
else
{
dt=session["udata"];
if(dt.rows.count>0)
{
dt.rows[dt.rows.count][0]="values";
}
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900