Asp:Button click event inside update panel not firing

Viewed 7946

What would cause an asp Button not to fire after a partial update has occured?

<asp:UpdatePanel ID="upPan" runat="server" UpdateMode="Conditional">
  <ContentTemplate>
    <asp:Button ID="btnSave" ClientIDMode="Static" runat="Server" Text="Save" CausesValidation="false" />
  </ContentTemplate>
</asp:UpdatePanel>
  • The first time any button is fired inside the update panel the below routines fire in this order.
  • After a postback has occured triggering the button again causes a postback, both Load and PreRenderComplete events fire but the click event is skipped.

VB

Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.PageLoad
  //Runs everytime
End Sub

Protected Sub btnSave_Click(sender As Object, e As EventArgs) Handles btnSave.Click
 //Doesn't fire after first postback.
End Sub

Protected Sub Page_PreRenderComplete(sender As Object, e As EventArgs) Handles Me.PreRenderComplete
  //Runs everytime
End Sub

FAILED RESOLUTIONS

Suggestions to resolve this include:

  • ChildrenAsTriggers= "True" This is already the default behaviour of UpdatePanel and offers no change.
  • <asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" /> Again by default child controls of the panel cause an asynchronous postback and declaring triggers is redundant.

SUCCESSFUL RESOLUTION

If I simply change the asp:Button into an asp:LinkButton the issue is resolved.


SUMMARY

The postback is occuring but the click event is being missed when the sender is an asp:Button control.

Can anyone explain what would cause this behaviour?

1 Answers
Related