UpdatePanel Button Click via Javascript

How to trigger a button click causing an UpdatePanel refresh

In ASP.Net, the <asp:UpdatePanel> allows us a quick an easy way to refresh screen content with server-side changes without the need for a full page post-back.

Sometimes it's necessary to trigger that refresh by using javascript, and in order to do that, we can use the following...

__doPostBack(document.getElementById("btnRefresh").name, "");

Or with jQuery...

__doPostBack($("#btnRefresh").prop("name"), "");

This is assuming that the <asp:Button runat="server" id="btnRefresh" /> is contained within the UpdatePanel, and that the button has not been set as a <Triggers><asp:PostBackTrigger/></Triggers>.

Added 29/06/2018 12:37