<pre lang="xml"><asp:UpdatePanel ID="up" UpdateMode="Conditional" runat="server"> <Triggers> <asp:AsyncPostBackTrigger ControlID="tm" EventName="Tick" /></Triggers> <ContentTemplate> <div style="position:absolute; top: 265px; left: 600px; height: 20px; width:150px; " id="col" runat="server"> <asp:Label ID="lbtime" Font-Bold="true" Width="100" ForeColor="White" runat="server" ></asp:Label></div> <asp:Label ID="lbtime0" runat="server" Font-Bold="true" ForeColor="Black" ></asp:Label> </ContentTemplate> </asp:UpdatePanel></pre> in code behind <pre lang="cs"> rotected void Timer_Tick(object sender, EventArgs e) { // lbtime.Visible = true; if (sender == tm) { string s = Convert.ToString(Request.Cookies["Contest"].Value); sqlread = dclass.GetRead("select * from CEntry where ContestTitle='" + Request.Cookies["Contest"].Value + "'"); if (sqlread.Read()) { DateTime startDate = System.DateTime.Now; DateTime timetoexpirecontest = Convert.ToDateTime(sqlread["Duration"]); TimeSpan t = timetoexpirecontest - startDate; // TimeSpan t2 = new TimeSpan(11,0,0); // t = t.Add(t2); if (t.Days <= 0 && t.Hours <= 0 && t.Minutes <= 0 && t.Seconds <= 0) { //countdown action //disable button } } } }</pre>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)