Click here to Skip to main content
15,885,952 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I working on online quiz program where i set the timer value according to my calucation :
protected void UpdateTimer_Tick(object sender, EventArgs e)
{
TimeSpan time1 = new TimeSpan();
time1 = (DateTime)Session["time"] - DateTime.Now;
if (time1.Minutes <= 0)
{
if (time1.Seconds <= 0)
{
// string strc = "alert('Timeout Please Refresh Page!')";
// ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScripts", strc, true);
}

}
else
{
string col = ":";
DateStampLabel.Text = (time1.Minutes.ToString()) + col + (time1.Seconds.ToString());
}


}
in this function when page get postback again and again it will reset the value of session .this value is bindind from the datatable every time so i just want to set the session value once and then use it whether page get postback or not .
Thanks
Posted
Comments
Varun Sareen 18-Feb-12 4:12am    
Can you please post some more code and please do a little formatting into your question so that it can be easily readable.

1 solution

Try:
C#
if (!IsPostback)
   {
   ...
   }
 
Share this answer
 
Comments
sharad_sharma82 18-Feb-12 3:38am    
i have used but its not working then i have applied !iscallback but it not properly working for me

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