html - confirmation on button not working -


for reason, confirmation function not working. here code:

<tr>                 <td align ="right" style ="width: 50%;">                     <asp:button id="button1" runat="server" text="confirm order"                          onclick="button1_click" onclientclick="confirm();" />                          <script type="text/javascript" language="javascript" >                             function confirm() {                                 if (page_clientvalidate())                                     return confirm('confirm order?');                             }                 </script>                     &nbsp;                 </td>                 <td align ="left" style ="width: 50%;">                     <asp:button id="button2" runat="server" text="cancel order"                          onclick="button2_click" onclientclick="cancel();" />                          <script type="text/javascript" language="javascript" >                             function cancel() {                                 if (page_clientvalidate())                                     return confirm('cancel order?');                             }                  </script> 

obviously want happen have confirmation when client clicks on button. line of codes fine in other pages. however, not working since calling function inside user control, have it?

thank help/tricks.

there should no return @ onclientclick="return validate();" should onclientclick="validate()" see code @ https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.onclientclick%28v=vs.110%29.aspx?f=255&mspperror=-2147217396


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -