JavaScript before postback a page with asp:button

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?
 
A

Amar

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top