Avatar of Vic-20
Flag for Australia asked on

ASP UpdatePanels not working together


I'm trying to test a simple example of 2 UpdatePanels with each posting back to the server for some "long operation" and updating the content of their respective label with a result. Basically, 2 async calls, each returning when done. Note I don't want to use Callbacks so please don’t suggest that. I want the UpdatePanel Model to work.

So, clicking both buttons has the problem that only the 2nd pressed button works and the 1st button is never updated. The code-behind can we traced and is clearly calling "UP1.Update()" but no update is shown in the browser. When button 2's update is called then UpdatePanel2 will update but UpdatePanel1 will remain frozen. This is the same if i reverse the order of pressing the buttons.

Basically, the 2nd press of either button is disrupting the update of the first such that it appears to never return for the first button pressed.


public partial class _Default : System.Web.UI.Page
  protected void Page_Load(object sender, EventArgs e)
  protected void btCalcDo_Click(object sender, EventArgs e)
       LabelCounter.Text = DateTime.Now.ToString();

protected void Button2_Click(object sender, EventArgs e)
      LabelCounter2.Text = DateTime.Now.ToString();


<head runat="server">
  <script type="text/javascript">
    function DoRefresh(pVisualButton, pActionButton) {
      var VisualButton = document.getElementById(pVisualButton);
      VisualButton.disabled = true;
      var ActionButton = document.getElementById(pActionButton);
  <form id="form1" runat="server">
      <asp:ScriptManager ID="ScriptManager1" runat="server">
      <asp:UpdatePanel runat="server" ID="UP1" UpdateMode="Conditional"
            <asp:Button ID="btCalc" runat="server" Text="Button" OnClientClick="DoRefresh('btCalc', 'btCalcDo'); return false;"
              Style="text-align: center" />
            <asp:Label ID="LabelCounter" runat="server" Text="Label" Style="text-align: center"></asp:Label>
            <asp:Button ID="btCalcDo" runat="server" OnClick="btCalcDo_Click" Style="visibility: hidden"
              Height="0px" Width="0px" />
      <asp:UpdatePanel ID="UP2" runat="server" UpdateMode="Conditional"
            <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="DoRefresh('Button1', 'Button2'); return false;"
              Style="text-align: center" />
            <asp:Label ID="LabelCounter2" runat="server" Text="Label" Style="text-align: center"></asp:Label>
            <asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Style="visibility: hidden"
              Height="0px" Width="0px" />



Avatar of undefined
Last Comment

8/22/2022 - Mon
Roopesh Reddy

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question

Ok, at least I know I'm not doing something wrong. The StackOverflow link was very well explained! Thanks for that.

Looks like I'll have to do 2 Callbacks then. Question is can the server call update an UpdatePanel from the Server with the same "UP1.Update()."
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck