javascript - I want to cancel page submit ,on cancel action of confirm using C# in asp.net4.0 -


i want stop page submit on cancel action of confirm .

what want achive , have form server validation, if user submit form without entering fields, should validate form , no confirm window should open. if user have filled fields , go on submit form, should confirm page submission (are sure want create user.), on clicking yes should submit page . on cancel should cancel page submission.

my problem cancel still submitting form.

my code in javascript follows:

function confirmsubmit() {     page_clientvalidate();      if (page_isvalid) {         if(!confirm('are sure?'))         {             return false;         }     } }  <asp:button id="btnsave" runat="server" onclientclick="javascript:return confirmsubmit()" onclick="btnsave_click" text="save" /> 

i have server code on btnsave_click.

please me , have tried many things not sucesseed

many thanks..

use on button client event

onclientclick="return confirm('confirm?');" 

try this:

  function confirmsubmit(){ page_clientvalidate();  if(page_isvalid) {  return confirm('confirm?');  } }   <asp:button id="btnsave" runat="server" onclientclick="javascript:return confirmsubmit()" onclick="btnsave_click" text="save" />  

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -