I've only just started playing with Atlas for the last week or so, but experienced the same problem as the original post. However I think I've figured out why it happens, and how you can get around it.
First, an explanation of my setup:
- A Master Page with two content placeholders called "LeftColumn" and "RightColumn"
- A regular Page (i.e. "Content Page") that uses the master page and overrides both content placeholders to provide its own content as follows:
- A LinkButton in LeftColumn called btnTest that updates a Label named lblTest
- An UpdatePanel in RightColumn defined as follows:
<
ATLAS:UPDATEPANEL id="pnlTest" runat="server">
<
CONTENTTEMPLATE>
<ASP:LABEL id="lblTest" runat="server">my ATLAS test label</ASP:LABEL>
</
CONTENTTEMPLATE>
<TRIGGERS>
</TRIGGERS>
</
ATLAS:UPDATEPANEL>
Note the emtpy "Triggers" element. If we add a trigger for btnTest we end up with this ugly error:
The ControlID property of the trigger must reference a valid control.
Instead of declaring the Trigger up front, we're going to add it programmatically... I'll explain why below.
If I'm understanding things correctly, the problem arises because of a combincation of factors:
- the UpdatePanel registers its triggers in the Init() stage of the Page lifecycle
- The btnTest LinkButton actually ends up with a client-side ID of ctl00_cphRightColumn_btnTest, since it is contained not only within the ASP:CONTENT element, but also the MasterPage (which your Page treats as yet another User Control... more on this later)
So your UpdatePanel is looking for a Click event raised by a control named btnTest, but by the time your page loads and renders itself, your button is called something completely different... I don't completely understand it, but it's almost like the ScriptManager is still smart enough to fire the LinkButton's Click() event through AJAX, but the UpdatePanel is looking for an event from btnTest instead of ctl00_cphRightColumn_btnTest so it doesn't bother updating itself. As a result, it appears that nothing happens (and yet with a breakpoint we can see that our PostBack really is happening!). Just a guess.
To address this problem I added a bit of code to my OnInit() handler:
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
ControlEventTrigger trigger = new ControlEventTrigger();
trigger.ControlID = btnTest.UniqueID;
trigger.EventName =
"Click";
pnlTest.Triggers.Add(trigger);
}
Pretty self-explanatory... I simply add a trigger to my UpdatePanel with the ID that my LinkButton is going to have when it is rendered. Note that I use btnTest.UniqueID (and not .ClientID) because of the problem with underscores that another poster has already mentioned.
With this code in place my postback works through AJAX and my UpdatePanel updates itself without a full Page PostBack.
Here is a great article that helped me semi-understand how Master Pages worked (including an explanation of how your Page treats its MasterPage like a UserControl, whcih helped me deduce what was going wrong and why): http://www.odetocode.com/Articles/450.aspx