I'm attempting to use an UpdatePanel, but can't get partial-page updates to work.
When I look at the ScriptManager's IsInAsyncPostBack property, it's always false.
Here's a page that reproduces the issue. It has a ScriptManager, an UpdatePanel, a LinkButton within the update panel, and a Button wired up to the UpdatePanel via the Triggers collection.
<%@ Page Language="C#" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToString();
if (IsPostBack)
Label1.Text += " - Postback!";
if (ScriptManager1.IsInAsyncPostBack)
Label1.Text += " - Async!";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" EnablePartialRendering="true" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
<ContentTemplate>Panel 1:<asp:Label runat=server ID=Label1 /><br />
<asp:LinkButton runat=server ID="LinkButton1" Text="Update!"></asp:LinkButton></ContentTemplate>
<Triggers><asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" /></Triggers>
</asp:UpdatePanel>
<asp:Button ID="Button1" Text="Refresh Panel 1" runat="server" UseSubmitBehavior=false />
</form>
</body>
</html>
If I run this code and click on either of the buttons, I see "Panel 1:2/8/2010 3:38:41 PM - Postback!"
I expected that clicking either button would cause a partial-page update for UpdatePanel1, that IsInAsyncPostBack would be true, and that " - Async!" would be appended to Label1.
Any idea why IsInAsyncPostBack is always false?