Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My scenario:

I have a timer in my master page that fired an event every second.I found out that each time the events fired the corresponding child page life cycle also is triggered.Due to this my child page keep refreshing(content is in an update panel).

My main problem is i have a drop down list on the child page and am unable to select a value because the page keep refreshing.

What I have tried:

Timer Code :

<asp:UpdatePanel ID="timer" UpdateMode="Conditional" runat="server" OnLoad="UpdatePanel1_Load" ChildrenAsTriggers="False" >
               <Triggers>
                  <asp:AsyncPostBackTrigger ControlID="TimerTimeLeft" EventName="Tick" />
               </Triggers>
               <ContentTemplate>
                  <asp:Timer ID="TimerTimeLeft" OnTick="TimerLeft_Tick1" runat="server" Interval="1000" />
                  <asp:Label ID="LblTimeLeft" runat="server" Text=""></asp:Label>
               </ContentTemplate>
          </asp:UpdatePanel>
Posted
Updated 11-Oct-19 0:24am

1 solution

Try setting the updatemode of the updatepanels to Conditional

UpdatePanel.UpdateMode Property (System.Web.UI) | Microsoft Docs[^]

That should mean each panel only updates when something in it triggers the update, it won't update when other panels update. Note that the code-behind lifecycle for the entire page will still run though (I think, this is from memory) but the browser won't update for your other dropdown so it should remain static.
 
Share this answer
 
Comments
Member 14619324 11-Oct-19 7:55am    
@F-ES SiteCore Your explanation was helpful,i added the code to all my update panel but now the trigger that causes the panel to change is a dynamic button(created at backend). Can you help adding this button as trigger for an update panel

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