I have an ASP Server Button on a User Control that triggers a Server-Side OnClick event which works fine. But I need to trigger the OnClick event using JavaScript or JQuery.
I have tried the following methods but neither actually simulate the results as if a User were to actually click the button:
document.getElementById('<%=btnRefresh.ClientID%>').click();
$('#<%=btnRefresh.ClientID %>').click();
I suspected this was possibly because this emulates a OnClientClick event and not the Server; but I have found claims that this has worked for others in successfully triggering the Server Side OnClick event but this is not working for me.
Is there any other way to accomplish the task?
In response to the suggestion of AJAX. I have tried that approach but a PostBack is required for this task to successfully complete. The actual Click of the button produces the desired result, I can cause the event to trigger using AJAX but without the element of PostBack it fails.