TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Rahul Lakshakar
NA
199
41.9k
Countdown timer in asp.net
Mar 30 2017 1:26 PM
i created a count down timer, but i am not getting how to show hour also it just showing seconds and minutes. Can any one guide me please...
My code is:
protected void Page_Load(object sender, EventArgs e)
{
if (!SM1.IsInAsyncPostBack)
{
Session["timeout"] = DateTime.Now.AddSeconds(120).ToString();
}
}
protected void timer1_tick(object sender, EventArgs e)
{
if (0 > DateTime.Compare(DateTime.Now, DateTime.Parse(Session["timeout"].ToString())))
{
lblTimer.Text = string.Format("Time Left: 00:{0}:{1}",
((Int32)DateTime.Parse(Session["timeout"].ToString()).Subtract(DateTime.Now).TotalMinutes).ToString(),
((Int32)DateTime.Parse(Session["timeout"].ToString()).Subtract(DateTime.Now).Seconds).ToString());
}
else
{
timer1.Enabled = true;
}
}
Reply
Answers (
2
)
how to show summary in mvc with views
How to call javascript when hot key is pressed?