.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
ffttt
Post New Web Links

how to create a countdown timer using C# and ASP.NET AJAX ?

Posted By:      Posted Date: November 02, 2010    Points: 0   Category :ASP.Net
 

 Hi guys,

Im about to start development on a countdown timer that will display the time left for a particular product.

the format will be like this - 00:00:11.

I have been watching the AJAX video tutorials so im thinking of approaching this by setting an updatePannel with a timer with a tick event every 1000ms. Inside the updatePannel i could have a label that is attached to a C# method that contains the countdown logic



2 questions...


1: is this a good way forward or not.

2: can anyone suggest data time classes/methods that i will find useful so for example an admin can enter a start date and an end date and the timer will show the days, hours, minutes and seconds remaining.

the site im trying to emulate is this ... http://www.telebid.com/ looks like they have AJAX countdown timers too.

thank you for your help

Truegilly




View Complete Post


More Related Resource Links

I thought this would be simple... Trying to create a login does an ajax check before submit

  

I have the standard .net login control that is working.  (Still learning .net after 15yrs of classic)

What I want to do is OnButtonClick run a javascript function (to do an ajax call to the db to check if login is valid or not) and if it returns true, then submit the form normally, else don't submit. The piece that I can't figure out, is how to correctly override the default click even to hit my JS routine and then submit the form properly afterwards.

Thanks ahead of time


Create databound nested ajax toolkit accordion programatically(In code Behind)

  

Can anyone guide me in the right direction or give an example of How I would accomplish this?

 

I have  this so far but kind of stuck on how to do it programtically if I'm using header and content templates 

I have a xmldatasource.. In a nutshell at what point in my code do I need to create a new accordion? does it need to be

in the item_databound handler?

 

Imports Microsoft.VisualBasic

Public Class AccordionTemplate
    Implements System.Web.UI.ITemplate

    Dim templateType As String

    Sub New(ByVal type As String)
        templateType = type
    End Sub

    Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) _
          Implements System.Web.UI.ITemplate.InstantiateIn

        Dim ph As New PlaceHolder()

        Select Case (templateType)
            Case "Header"
                Dim myLabel As Label = New Label()
                myLabel.Text = "Test"
                ph.Controls.Add(myLabel)
            Case "Content"
                ph.Controls.Add(New LiteralControl("<p>hello</p>"))
        End Select
        container.Controls.Add(ph)
    End Sub


End Class

 

 

Partial Class Accordion
    Inherits System.Web.UI.Page

    Protecte

Countdown Timer for Fantasy League Draft Site

  
I am looking to do a countdown timer for time remaining to make a draft pick.  I have seen a number of countdown timers such as: Timer1 Timer2 Timer3In all of these timers, I'm not seeing an easy way to change the Target Date via the code behind.  The timer would need to be reset after a user makes a draft pick.I also would like the timer to be server side as opposed to client side.Any help would be appreciated.

Why ASP.Net AJAX Timer control stops ticking when we right click on the page?

  
Asp.Net AJAX Timer control stops ticking when I right click on the page. Actually i am updating a label using timer control for every second. When I right click on the page the label is not getting updated. I mean the timer stops ticking. Please tell me what is actually happening and how can i resolve it.

two ajax needs - first timer

  
Hello,I have not used ajax yet. I use both VS 2008 and VS 2010. I have the ajax control toolkit installed. There are two primary things I need ajax for:1. visual feedback that a search is running. I've seen this on many apps, I need the whole page to be dimmed, and some simple animation to play indicating work is being done.2. I need to setup a master/detail view where when a user selects a row from the master datagrid, the detail view (either a formview or a detailview control, not sure which yet) will appear below it showing the further detail info of that selected row, without full page postback. I will actually have a few different 'detail view' controls, because depending on the type of record they select from the parent datagrid control, the detail view will have a different set of data, as in different schema, not just a different record. So I will need to check the 'type' of record selected in the parent, and then dynamically show the appropriate detail data in the appropriate detail view control. Again, no full page postback, and the same visual indication that work is being done like in my number 1, only this time just showing a simple animation in the section below the parent grid where the detail data is soon to appear, not the full page dimming thing.Those are my two goals. I'm completely new to ajax. Could someone let me know which ajax con

Create a progress bar based on progress of AJAX handler

  
I've got a plain C# web page that uses jQuery to call a handler page using AJAX. While the handler content is loading, a message "Please Wait, loading..." is displayed. Once I've got the content back from the handler I hide the loading message and display the content.What I'd like to do is after the loading message, display a percentage of how far through the handler page is. All the handler page does is loop through a list of members, powered by a web service, and adds them to the database so I know exactly how many members are being added to the database so I can tell how far I am through.The problem I'm having is because all of this goes on in a handler, how can I send the progress percentage back to the main web page while the handler was still loading.Any ideas? If I could do the exact same task but differently which would allow me to create the progress bar, I'd be happy to hear any suggestions.

How can I create Dyanamic Ajax Control

  
Hi All,I have use all the ajax control from the http://www.asp.net/ajax website.But here I have the static control.Now in project I have to created dynamic .Please tell me the code for creating dynamic ajax control.Thank you.

CountDown timer for an auction

  

Hello,

I would like if someone can help me with an script or to guide me, for an countdown timer. I have an auction site and already a end date, but what i don't know is how to do to show me how many days hours and minutes.

I read several posts here, but none of them seems to work. It doesn't show nothing

this is it what i have, on my page, and it is showing the end date, but how do i do, to show a countdown  

Please can someone hellp me

Regards,


This is .cs

stoptime.Text = dr["***"].ToString();
 
.aspx
<asp:Label id="stoptime" runat="server" Font-Bold="true" ForeColor="#0066FF" Font-Size="Small"></asp:Label>
 
 


 


Ajax timer issue

  

Hello,

              I have an timer outside of UpdatePanel that refreshes every 30 seconds. In the timer's OnTick function, I check the status of some operation from database. If the operation is complete i disable the timer otherwise I enable it. I call timer.Enabled = true. will this cause problem, until the process is complete I keep setting timer.Enabled = true. What happens is that after few hours when multiple users do the same operation the database connection goes down and I cant connect to database at all. the database connection and recordset are closed everytime I checked it.. Any clues on this issue??

 

 

Thanks,

Bharani


how to use countdown timer?

  

<p>hi , i want to make the the page which show the countdown timer.... i have the coding in which the initial time of the countdown timer is given in the coding... but i want to enter its initial time from my data base can you help me...</p> 

 

my html page is given here......

 

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="test3.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <br />
        
        
    <asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>

    <asp:Label ID="Label6" runat="server">0</asp:Label>
<asp:Label ID="Label5" runat="server">0</asp:Label>
    <asp:Label ID=&qu

how to create a timer in javascript

  

i am making one web site(online test),now i want to give some time limit to answer the questions,like 10 min.how can i make a timer with 10 min in javascript to show the time in label control..

plz help me


Can I create a timer job to run a custom code everyday?

  

Hello guys,

I have to run some calculations at sometime everyday through code in sharepoint. So How can i make sure that this code runs at particular time to perform those calculations.

If you guys know anything, let me know.

Thanks


Countdown timer counts double

  

Hi there, i added a countdown timer to show seconds before page gets refreshed. But every tick counts 2 seconds instead of 1 .. so it goes from 30 > 28 > 26 instead of 30 > 29 > 28 ..

On page load I set the label value to 30.

The update panel contains following code for 2 labels and timer:

<asp:UpdatePanel ID="UpdatePanel3" runat="server">
            <ContentTemplate>
            <asp:Label ID="lblRefresh" runat="server" Text="Volgende Refresh"></asp:Label>: 
            <asp:Label ID="lblRefreshTeller" runat="server" Text=""></asp:Label> sec
            </ContentTemplate>
            <Triggers>
            <asp:AsyncPostBackTrigger  ControlID="Timer2" />
            </Triggers>
            </asp:UpdatePanel>
            <asp:Timer ID="Timer2" runat="server" Interval="1000" OnTick="Timer2_Tick"></asp:Timer>


 

 

Code behind:

Protected Sub Timer2_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        Dim seconds As Integer = Integer.Parse(lblRefreshTeller.Text)
        If seconds > 0 Then
     

Ajax timer affecting CPU performance

  

Hi,

 

I'm using an ajax timer to show different time zones. Also, I'm placing ajax timers to update user controls on my page.

For example, I'm placing 3-4 timers on my page to update my user controls and displaying various time zones. My problem is

this is badly affecting my CPU performance. It is using 20-30% CPU usage. I tried increasing the timer interval from one sec to

6 seconds. This fairly improved the performance. Is there any other way of improving CPU performance ?

 

I'm updating my user control like this:

<asp:UpdatePanel ID="updateGradeTable" runat="server"  UpdateMode="Conditional">
        <ContentTemplate>
     		<uc1:GradeTable ID="gradeTable" UpdateMode="Conditional" runat="server" />
                <asp:Timer ID="tm1" runat="server" OnTick="tm1_Tick" Interval="7000"></asp:Timer>
        </ContentTemplate>
</asp:UpdatePanel>
 
I'm updating my timer like this:
 
 

Calling a javascript function from server side, using AJAX timer

  

 Hello,

I am developing a ASP.NET ajax application.
I am using a timer:

<asp:Timer ID="Timer1" runat="server" OnTick="Timer_Tick" Interval="5000" />      

The only thing I want to do is to call a javascript function on every tick of the timer:

 protected void Timer_Tick(object sender, EventArgs e)
        {
            ClientScript.RegisterClientScriptBlock(this.GetType(), "blink", "<script>blinkit('2');</script>");
        }

This doesn't work.
The javascript function is being called only if I put the 'RegisterClientScriptBlock' in the Page_Load.

How can I call the javascript every couple of seconds?

Thank you


create custom timer job to start a workflow

  

i have created a project with visual studio, to start every day a workflow on every item in a list.

when i place my code in a webpart and i run the code on 1 item, the workflow will start normally.

when i place my code in the  timer job in the execute method, the timer job will finnish normally but there will be not workflow started.

 

public override void Execute(Guid contentDbId)
        {

            SPWorkflowManager objWorkflowManager = null;
            SPWorkflowAssociationCollection objWorkflowAssociationCollection = null;

            using (SPSite mySiteCollection = new SPSite(siteurl))
            {
                using (SPWeb mySite = mySiteCollection.OpenWeb())
                {
                    try
             

Ajax Timer

  

Hi 
i'm sorry for my bad redaction
I have a Timer in  my master page but when change a content page,the  timer 
stops.
I want  the timer "keep alive"  through change of content pages,how can i do this?
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend