Click here to Skip to main content
16,011,849 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I'm using ajax timer control in asp.net to develop online examination web application,

also i have fixed interval=6000 and if my page is rendering before this interval then
my time is being also constant.


this is my code....


C#
protected void Timer1_Tick(object sender, EventArgs e)
    {
       Convert.ToDateTime(System.DateTime.Now.ToShortTimeString()).Subtract(Convert.ToDateTime(ViewState["StartTime"]) );
        + " minutes of 60";


            if (LblTimer.Text.ToString() == "01:30:00")
            {
                // do nothing
                Btnback.Visible = false;
                BtnNext.Text = "Finished";
                updateCandidateTestHistory();
            }
            else
            {

                DateTime dt = Convert.ToDateTime(ViewState["ElapsedTime"]);

                 dt = dt.AddMinutes(30);

                 ViewState["ElapsedTime"] = dt;
                }
                    string dt1;
                    dt1 = dt.TimeOfDay.ToString();


             
                LblTimer.Text = dt1.ToString();

            }
        }


If i'm clicking on button "NextQuestion" before 1 minute then value of lblTimer is not increasing.

pls Please give me any proper solution..
Posted
Updated 28-Apr-12 22:26pm
v2
Comments
Shahin Khorshidnia 29-Apr-12 4:29am    
Not a clear question.
At least "I" can't unserstand!
Sergey Alexandrovich Kryukov 29-Apr-12 17:50pm    
Such posts should be classified as "Not a question" and reported accordingly. Who needs guess work?
--SA
Shahin Khorshidnia 29-Apr-12 17:58pm    
Yes, but I thought I was the only one that's misunderstanding :D
Sergey Alexandrovich Kryukov 30-Apr-12 19:03pm    
I understand that. I also often doubt about my understanding, because sometimes other people can catch some sense where I failed to understand it. Perhaps it needs more patience.
--SA
Sunasara Imdadhusen 29-May-12 8:50am    
Required more clarification!!

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