javascript - Unbind the client click event of a asp button but keep the server click event of the asp button attached -


i need fire server click event inside client click event specific condition. know, if client click returns true server click event fired. onclientclick showing jconfirm. want fire server click of same button when jconfirm returns true. trying this:

<asp:button id="button1" runat="server" text="add" onclick="btnadd_click" validationgroup="add" causesvalidation="true" onclientclick="return validate()" />   function validate() {      if (page_clientvalidate('add')) {          if ($('#<%=ddltestfield.clientid%>').val() == '0') {              var strmessage = 'continue?';              $.alerts.okbutton = 'ok';              $.alerts.cancelbutton = 'cancel';              jconfirm(strmessage, 'confirm message', function (r) {                 if(r)                 {                     $('#<%=button1.clientid%>').unbind("click"); // unbind client event                     $('#<%=button1.clientid%>').click(); // fire server click event, firing client click also. loop goes on                 }             });         }         return true;     }     return false; } 

i found solution

if(r) {       <%= page.clientscript.getpostbackeventreference(button1, string.empty) %>; } 

Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -