DotNet Solution

  • Home
  • Asp.net
    • Controls
    • DataControl
    • Ajax
  • Web Design
    • Html
    • Css
    • Java Script
  • Sql
    • Queries
    • Function
    • Stored Procedures
  • MVC
    • OverView
    • Create First Application
  • BootStrap
    • Collapse Function

Tuesday, 1 March 2016

How To Timer Work in Asp.net

  Unknown       21:19       Ajax       No comments    

Using a Timer Control Inside an UpdatePanel Control

When the Timer control is included inside an UpdatePanel control, the Timer control automatically works as a trigger for the UpdatePanel control. You can override this behavior by setting the ChildrenAsTriggers property of the UpdatePanel control to false.
For Timer controls inside an UpdatePanel control, the JavaScript timing component is re-created only when each postback finishes. Therefore, the timed interval does not start until the page returns from the postback. For instance, if the Interval property is set to 60,000 milliseconds (60 seconds) but the postback takes 3 seconds to complete, the next postback will occur 63 seconds after the previous postback.
The following example shows how to include a Timer control inside an UpdatePanel control.

<asp:ScriptManager runat="server" id="ScriptManager1" />
<asp:UpdatePanel runat="server" id="UpdatePanel1" 
    UpdateMode="Conditional">
  <contenttemplate>
    <asp:Timer id="Timer1" runat="server"
      Interval="120000" 
      OnTick="Timer1_Tick">
    </asp:Timer>
  </contenttemplate>
</asp:UpdatePanel>

Using a Timer Control Outside an UpdatePanel Control

When the Timer control is outside an UpdatePanel control, you must explicitly define the Timer control as a trigger for the UpdatePanel control to be updated.
If the Timer controls is outside an UpdatePanel control, the JavaScript timing component continues to run as the postback is being processed. For example, if the Interval property is set to 60,000 milliseconds (60 seconds) and the postback takes 3 seconds to complete, the next postback will occur 60 seconds after the previous postback. The user will see the refreshed content in the UpdatePanel control for only 57 seconds.
You must set the Interval property to a value that enables one asynchronous postback to complete before the next postback is initiated. If a new postback is initiated while an earlier postback is being processed, the first postback is canceled.
The following example shows how to use the Timer control outside an UpdatePanel control.
<asp:ScriptManager runat="server" id="ScriptManager1" />
<asp:Timer ID="Timer1" runat="server" Interval="120000" 
  OnTick="Timer1_Tick">
</asp:Timer>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
  <Triggers>
    <asp:AsyncPostBackTrigger ControlID="Timer1" 
        EventName="Tick" />
    </Triggers>
    <ContentTemplate>
      <asp:Label ID="Label1" runat="server" ></asp:Label>
  </ContentTemplate>
</asp:UpdatePanel>
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
Email This BlogThis! Share to X Share to Facebook
Newer Post Older Post Home

0 comments :

Post a Comment

Popular Posts

  • Auto Increment Id in Sql Server
    SQL server identity column values use in table Steps- Firstly Open-> Sql Server Create Table -> First Field Like ID Usually Autoi...
  • (no title)
    SQL SELECT Query The SELECT statement is used to select data from a database. Query SELECT * FROM TABLE NAME. Use this query we get All...
  • MVC OverView
    I ntroduction The Model-View-Controller (MVC) architectural pattern separates an application into three main components: the model, the v...
  • CSS 3D Transforms
    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head...
  • Create First MVC Application
    How to create MVC First simple application It is very easy to make application in mvc follow some steps and create first application ST...
  • Values Enter With SplitFunction in Sql Server
    Basically We Use Split Function Thorugh Commma Sepertaed string value with  Comma  Means One Then more value through split function Enter...
  • Alter Query
    To add a column in a table, use Alter Query the following syntax: ALTER TABLE table_name ADD column_name datatype. To delete a column ...
  • Javascript Regular Expression Email Validate
    Validate Email using Regular Expression In JavaScript- 1. Create Input type Text box and and onclick cal  checkemail function of Javascr...
  • Get Random Rows in SqlServer
    How To Get  Random  ROWS in  Table  Using Sql Server Step 1-                Open Sql Server and Create Table like in Ex. Ex. Step...
  • Current Date
    Show Current Date-  I Want To Show Current Date Then Use-   SELECT GETDATE()  AS CurrentDate OutPut-            2016-06-08 12:11:00.08...

Blog Archive

  • ▼  2016 ( 36 )
    • ►  February ( 1 )
    • ▼  March ( 5 )
      • How To Timer Work in Asp.net
      • SQL SELECT Query The SELECT statement is used to ...
      • The INSERT INTO statement is used to insert new r...
      • CHECK WHETHER DUPLICATE EATERY IF((SELECT COUNT(...
      • Alter Query
    • ►  April ( 1 )
    • ►  June ( 10 )
    • ►  July ( 6 )
    • ►  November ( 8 )
    • ►  December ( 5 )
  • ►  2017 ( 1 )
    • ►  January ( 1 )
Powered by Blogger.

Categories

  • Ajax
  • AllFunction
  • Controls
  • CreateApplication
  • css
  • Function
  • javascript
  • Js
  • over view
  • OverView
  • Queries
  • StoredProcedures

Text Widget

Sample Text

Pages

  • Home

Copyright © DotNet Solution | Powered by Blogger
Design by Vibha Acharya