Reputation: 2837
I have an UpdatePanel on a pretty slow page. Its UpdatePanel is set to update conditionally. The problem I'm facing is that the UpdatePanel does a partial postback immediately on being rendered clientside. My questions are:
Thanks for your help.
Markup:
<asp:UpdatePanel UpdateMode="Conditional" ChildrenAsTriggers="false" runat="server" ID="updatePnlValidationErrors">
<ContentTemplate>
<span runat="server" id="validationErrors" class="error"></span>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger EventName="Click" ControlID="btnCompletePurchase" />
<asp:AsyncPostBackTrigger EventName="Checkout_Click" ControlID="checkoutBox" />
</Triggers>
</asp:UpdatePanel>
There is no code directly touching the UpdatePanel.
Upvotes: 1
Views: 1328
Reputation: 2592
OK, your asyncpostbacktrigger in your code are not pointing to the right controls I guess, you may have eliminated them only for the demo purposes but they are critical for our test. here is my complete simulation of your code and its results at the end.
I have added two missing associated controls for your AsyncPostBackTriggers outside your update panel;
<asp:Button ID="btnCompletePurchase" runat="server" Text="Button" OnClick="btnCompletePurchase_Click" /> <asp:CheckBox ID="checkoutBox" runat="server" OnCheckedChanged="checkoutBox_CheckedChanged" />
and your code will look like the code below:
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> <asp:Button ID="btnCompletePurchase" runat="server" Text="Button" OnClick="btnCompletePurchase_Click" /> <asp:CheckBox ID="checkoutBox" runat="server" OnCheckedChanged="checkoutBox_CheckedChanged" /> <asp:UpdatePanel UpdateMode="Conditional" ChildrenAsTriggers="false" runat="server" ID="updatePnlValidationErrors"> <ContentTemplate> <span runat="server" id="validationErrors" class="error"></span> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger EventName="Click" ControlID="btnCompletePurchase" /> <asp:AsyncPostBackTrigger EventName="CheckedChanged" ControlID="checkoutBox" /> </Triggers> </asp:UpdatePanel>
and here is the break point result on first time Page_Load event:
so you could copy and paste this code to check the result at your end as well.
Upvotes: 1