Countdown -Timer ajax control c#.net Asp.net
Hi, Today we will learn about Timer ajax control In Asp.net. we can find the timer control in ajax controls list from Toolbox in asp.net.Here we take an example of ajax timer controls in asp.net. we will display current time and date on web forms in asp.net.
- Note: need ajax control toolkit to feature first.
- You can download it from http://www.asp.net/ajaxlibrary/AjaxControlToolkitSampleSite/
- here are many samples for ajax tools & after downloading this sample kit,
- you can find many sample code for a way to use ajax controls in your website
- In Addition, I make CSS for the round corner of div tag, my div is as a circle
//Design Page … Save it as timer.aspx
//////////////////
Code Behind File Save it as timer.aspx.cs
///////////////////////////////////////////////////////////////////////////////
using System; usingSystem.Collections; usingSystem.Configuration; usingSystem.Data; usingSystem.Linq; usingSystem.Web; usingSystem.Web.Security; usingSystem.Web.UI; usingSystem.Web.UI.HtmlControls; usingSystem.Web.UI.WebControls; usingSystem.Web.UI.WebControls.WebParts; usingSystem.Xml.Linq; public partial class timer : System.Web.UI.Page { static DateTime setdt; protected void Page_Load(objectsender, EventArgs e) { } protected void Timer1_Tick(objectsender, EventArgs e) { DateTimedt = DateTime.Now; TimeSpandiffer; System.DateTimedate1 = new System.DateTime(2013, 4, 1, 20, 10, 0); differ = date1.Subtract(dt); double t = differ.TotalSeconds; if(t>0) { doubleyr, mnth, dy, h, m, s; dy = differ.Days; h = differ.Hours; m = differ.Minutes; s = differ.Seconds; Label1.Text = dy.ToString();// +” Days ” + h + ” Hours ” + m + ” Minutes ” + s + ” Seconds left for celebration”; Label2.Text = h.ToString(); Label3.Text = m.ToString(); Label4.Text = s.ToString(); } else { Timer1.Enabled = false; } } }
Do you know:-
- The Command Class | C# | TrickCode
- C# DataReader ADO.NET |Trickcode
- What is disconnected data access?
- how to Adding Parameters to Commands
- SQL Basics?
- What is Database Preparations?
- SQL vs NoSQL or MySQL vs MongoDB
- What is data provider in C#?
- What is connection string C#?
- [SQL] SELECT Statement | Example
- how to get return value from stored procedure in sql server
- how to prevent sql injection attacks
- What is Database? What is SQL?
- C#.Net How To: Send email in asp.net using c#
If you like the tutorial, then please share this tutorial with your friends on social media.
Post A Comment:
0 comments: