I have a hidden button on a form that I need to click in order to fire an asyncpostback trigger that's attached to an update panel.
How is this done?
For the Webform: if you set the Visible property to false; typically in .net the control will not be rendered in the HTML output after the page is processed. Therefore as far as jQuery is concerned, the button does not exist.
You can do a View Source on the page to verify this.
If you want to do this, instead of using the Visible property, you can do something like:
<asp:Button ID="HiddenButtonID" runat="server" style="visibility: hidden; display: none;" />
Then you can using jQuery to click button as :
$("#HiddenButtonID").click(); //Remember that in button, you must set ClientIDMode = "static"
or
$("#<%=HiddenButtonID.ClientID%>").Click();
$('#myHiddenButton').trigger("click");
Or just
$('#myHiddenButton').click();
See Events/Trigger
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With