Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
3.00/5 (2 votes)
See more:
i have nine td's on my webpage with nine update panel's on every td and with nine asp timer
here when i load the page, timer tick event of every timer occur one by one after a long pauses.
here i want timer tick of every timer to occur simultaneously not by one by one.
Posted
Comments
Krunal Rohit 11-Feb-14 2:23am    
you mean parellely ?
The14thNoah 11-Feb-14 2:32am    
if you want to tick all the timer simultaneously,maybe you should use only one timer. . .but if every timer has some function to do then please see my code below. :)

set all your timers Interval the same so that it will tick simultaneously

C#
 <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<table>
<tr>
<td align="right" class="style9">
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
                    </Triggers>
                    <ContentTemplate>
                       <asp:Timer ID="Timer1" runat="server" Interval="1000" ontick="Timer1_Tick"></asp:Timer>
                    </ContentTemplate>
                    </asp:UpdatePanel>
</td>
</tr>
</table>


on the code behind
C#
protected void Timer1_Tick(object sender, EventArgs e)
   {
    //do something
   }


hope this will help :)
 
Share this answer
 
v3
Comments
ank170989 11-Feb-14 4:28am    
start method doesn't exist pls tell how to use start merhod
The14thNoah 11-Feb-14 19:05pm    
I dont know the reason but Timer has no start method. . .but please see my updated solution,. .I will post the code in one of my project using timer
Quote:
start method doesn't exist pls tell how to use start merhod


First , answering for the doubt raised in the comment.
MSDN clearly says :

Quote:
The Tick event is raised when the number of milliseconds specified in the Interval property has elapsed either since the Web page was rendered or since the previous Tick event.



Can try the suggestion in the first solution .But would like to have the updatemode conditional . Something like below for all the TDs with same interval.

<asp:updatepanel id="UpdatePanel1" runat="server" childrenastriggers="false" updatemode="Conditional" xmlns:asp="#unknown">
        <contenttemplate>
           //Content to Update
        </contenttemplate>
        <triggers>
            <asp:asyncpostbacktrigger controlid="Timer1" />
        </triggers>
</asp:updatepanel>
 <asp:timer id="Timer1" runat="server" interval="1000" ontick="Timer1_Tick" xmlns:asp="#unknown"> </asp:timer>
 
Share this answer
 
Comments
The14thNoah 12-Feb-14 1:22am    
tnx for the comment,i will note your answer :)
JoCodes 12-Feb-14 8:37am    
Welcome :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900