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