views:

19

answers:

1

In asp.net page, How can i call the javascript methods for form processing-submitting if the user browser supports javascript and use code behind events if the browser does not support javascript.I have the javascript code to send the form data to an ajax server page using jquery. Don't know how to invoke the needed one based on the browsers javascript availability

+1  A: 

Create the form that does a postback and submits the data without JavaScript then set the click event on the submit button to call your javascript function. Then use e.peventDefault() and e.stopPropagation() in the click event to prevent postback.

You may also need to capture the enter key press event and prevent it from causing a post back as well.

Kenneth J