JavaScript before postback a page with asp:button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an aspx page and I need that when the user press a Submit button it
first executes a javascript function to validate some input information, if
the validation pass continue with the postback, if it isn't stay in the page.
SOme help?
 
Put
<form id="Form1" onsubmit="return CheckData()" method="post"
runat="server">

CheckData() is your javascript function. Make any calculations you
want inside and return true if you want the postback to execute and
the server code, otherwise return false and page will not postback
 
Back
Top