المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Implementing Timer Functionality in Online Test Application



C# Programming
06-23-2009, 03:40 PM
I am using Ajax Timer control in my OnlineTest Application.

suppose if exam duration 45 mintes means i am adding 45 minutes to server time and i am subtracting with current server time and i will get 45 minutes with that i am reducing time in the form of seconds

like 45:59,45:58.

I am using ASP.Net 2.0,Ajax1.0, MS Access Database.

but during postback means if i click on "Next" button(next question will appear in the next page)

that time i am not able to maintain time what ever time it has taken during postback again from that i am able to continue again..please could u help me regard in this



this is my aspx page

























this is Code behind code

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataSet dsServerTime = new DataSet();
DataSet dsExamTime = new DataSet();
dsServerTime = objOnlineTestPaperBAL.GetServerTime();

dsExamTime = objOnlineTestPaperBAL.GetServerTimeWithExamDuration(ExamTime);
if (dsServerTime.Tables[0].Rows.Count > 0)
{

string serverTime = dsExamTime.Tables[0].Rows[0]["ExamTime"].ToString();

minutes = Convert.ToInt32(serverTime);

hid_Ticker.Value = new TimeSpan(Hours, minutes, seconds).ToString();

if (Session["time"] != null)
{
string time = (string)Session["time"];
string[] str1 = time.Split(':');
minutes = Convert.ToInt32(str1[1]);
seconds = Convert.ToInt32(str1[2]);
lblStartTimeValue.Text = Convert.ToString(minutes) + " : " + Convert.ToString(seconds);
hid_Ticker.Value = new TimeSpan(Hours, minutes, seconds).ToString();
Session["time"] = hid_Ticker.Value;
}
else
{
lblStartTimeValue.Text = Convert.ToString(minutes) + " : " + Convert.ToString(seconds);
}
}
}
Session["TestStart"] = System.DateTime.Now;

}



please help me regard in this....