Ok so i ran into a curious problem that I was able to narrow down to the following code. I have created a new Web Forms project and added some controls in UpdatePanels:
Default.aspx
<asp:UpdatePanel runat="server" ID="udpDefault">
<ContentTemplate>
<asp:LinkButton runat="server" ID="lbPost" Text="Click for error" OnClick="lbPost_Click"></asp:LinkButton>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress runat="server" AssociatedUpdatePanelID="udpDefault">
<ProgressTemplate>
Updating...
</ProgressTemplate>
</asp:UpdateProgress>
Default.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
if(IsPostBack)
{
(Master as SiteMaster).ShowInfoMessage("Test info message");
}
}
protected void lbPost_Click(object sender, EventArgs e) { }
Site.Master
<asp:UpdatePanel runat="server" ID="pSubHeaderInfoAsync" Visible="false">
<ContentTemplate>
<asp:Label runat="server" ID="lInfoMessageAsync"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
Site.Master.cs
protected void Page_Load(object sender, EventArgs e) { }
public void ShowInfoMessage(string info)
{
pSubHeaderInfoAsync.Visible = true; //this causes the problem
lInfoMessageAsync.Text = info;
}
Now the expected behavior would be: User clicks the LinkButton on the content page and a panel with an info message shows up on the master page. But it doesn't. The "Updating..." from the UpdateProgress never disappears and in the browser console you can see a generic AJAX error:
TypeError: Sys.WebForms.Res is undefined.
The problem seems to be the commented line that sets the visibility of the UpdatePanel. If I change the code and remove Visible="false" from the view and also delete the line mentioned before, it works.
Moving this logic to the content page also gets it to work (including changing the visibility of the UpdatePanel).
One more observation: if I set the UpdatePanel's visibility to "true" in the designer, it also works (because the code doesn't change the visibility value because it is already true).
Any explanations for this behavior are much appreciated :)