c# - Execute postback url from another button -
i have 2 buttons , buttona (normal 1 ) , buttonb (has postbackurl) , need execute (buttonb) click of buttona
<asp:button id="buttona" runat="server" text="button" /> <asp:button id="buttonb" postbackurl="url" runat="server" text="button" /> <script> $(document).ready(function() { $("#<%= buttona.clientid%>").click(function(){ $("#<%= buttonb.clientid%>").trigger("click"); }); }); </script>
can tell me , how , either jquery or codebehind , because don't know if it's possible ? thanks,
unless posting data form buttonb's postbackurl
, have window redirect postbackurl so:
<asp:button id="buttona" runat="server" text="button" /> <script> $(document).ready(function() { $("#<%= buttona.clientid%>").click(function(){ window.location.href = 'url'; }); }); </script>
there's no need invoke click event of button redirect different location.
however, if indeed posting data form server, need this:
<asp:button id="buttona" runat="server" text="button" /> <asp:button id="buttonb" postbackurl="url" runat="server" text="button" /> <script> $(document).ready(function() { $("#<%= buttona.clientid%>").click(function(){ $("#<%= buttonb.clientid%>").click(); }); }); </script>