c# - Asp:Button - if OnClientClick = True | False -


<asp:button id="invoice" runat="server" text="create invoice" onclientclick="createinvoice_click()" onclick="createinvoice_click1"/>            <script type="text/javascript" language="javascript">                    function create_invoice() {                     $("#dialog-confirm").dialog({                         resizable: false,                         height: 180,                         modal: true,                         buttons: {                             create: function () {                                 $(this).dialog("close");                             },                             cancel: function () {                               //code needed here                                 $(this).dialog("close");                             }                         }                     });                 }                 </script>        <p><span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>are sure?</p> 

so user presses 'create invoice' button, pop appears allowing user select 'create' or 'cancel'.

the 'createinvoice_click' function run on code behind if user clicks 'create' or 'cancel'. want know (which needs go inside 'cancel' function') how ignore onclick="createinvoice_click1" if cancelled clicked.?

thanks replies

if want prevent server side function execution need return false in client side function.

function create_invoice() {     $("#dialog-confirm").dialog({         resizable: false,         height: 180,         modal: true,         buttons: {             create: function () {                 $(this).dialog("close");             },             cancel: function () {               //code needed here                 $(this).dialog("close");                 return false;// that's need             }         }     }); } 

Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -