Asked by:
Two Timer control in the same page

Question
-
User-172676812 posted
Hi all,
I use new asp.net Ajax V1.
I would like to put on my page two Timer Control.
But When my UpdatePanel1 is updated, my second part is emptied. Then my updatePanel2 is updated my first part is emptied
Have an idea to prevent that my updatePanel is emptied ?In my page aspx
<asp:ScriptManager runat="server" ID="ScriptManager1" EnablePartialRendering="true" ></asp:ScriptManager>
<asp:Timer runat="server" Interval="20000" ID="TimerControl1" OnTick="tickerTimer1_Tick" />
<asp:UpdatePanel runat="server" ID="UpdatePanel1" RenderMode="Block" >
<Triggers>
<asp:PostBackTrigger ControlID="TimerControlMessage"/>
</Triggers>
<ContentTemplate>
my firt part : label
</ContentTemplate>
</asp:UpdatePanel>
<asp:Timer runat="server" Interval="30000" ID="TimerControl2" OnTick="tickerTimer2_Tick" />
<asp:UpdatePanel runat="server" ID="UpdatePanel2" UpdateMode="Always" RenderMode="Inline" >
<Triggers>
<asp:AsyncPostBackTrigger ControlID="TimerControl2" EventName="Tick" />
</Triggers>
<ContentTemplate>
my second part : gridview
</ContentTemplate>
</asp:UpdatePanel>In my code behind C#
protected void tickerTimer1_Tick(object sender, EventArgs e)
{
//update only my firt part
}protected void tickerTimer2_Tick(object sender, EventArgs e)
{
//update only my second part (only my gridview)
}Thank you for your help.
Cheers.Tuesday, January 30, 2007 4:35 PM
All replies
-
User1178851682 posted
when you said empty, you mean information in ContentTemplate is empty?
in this case you can do
protected void tickerTimer1_Tick(object sender, EventArgs e)
{
//update only my firt part//Also make second empty (maybe visible = false)
}protected void tickerTimer2_Tick(object sender, EventArgs e)
{
//update only my second part (only my gridview)//Also make Frist empty (maybe label.Text = string.empty)
}Hope this help
Tuesday, January 30, 2007 5:59 PM -
User-172676812 posted
precisely not, I would like that my two contentTemplate stay full.I would like to use 2 Timer Control with 2 separated UpdatePanel Controls.But when my tickerTimer1 updates my contentUpdate1, I don't want that my contentUpdate2 is also updates.And conversely when my tickerTimer2 updates my contentUpdate2, I don't want that my contentUpdate1 is also updates.Wednesday, January 31, 2007 1:32 AM -
User-172676812 posted
I had UpdateMode="Conditional" and now its works. Thanks Steve Marx :-)
<asp:UpdatePanel runat="server" ID="UpdatePanel2" UpdateMode="Conditional" RenderMode="Inline" >
<Triggers>
<asp:AsyncPostBackTrigger ControlID="TimerControl2" EventName="Tick" />
</Triggers>
<ContentTemplate>
my second part : gridview
</ContentTemplate>
</asp:UpdatePanel>Wednesday, January 31, 2007 2:46 PM -
User-722228031 posted
Thank you, been fighting with two timers for an hour, then came across your question.
Thanks for posting the solution.
Omer
Monday, November 10, 2014 1:49 AM