Question : jquery validator and asp.net updatepanel

let's say that I have a formview inside of an UpdatePanel, and an Insert or Update button to trigger the formview insert/update method.

I added the jquery validator plugin and it works fine, like it will popup the error msg if i input the wrong email address format
but it doesn't work with the formview button.

As long as I click the insert or update button, the updatepanel async postback will occur regardless the jquery validator, how do i bind the button with the jquery validator to trigger the validation?

Answer : jquery validator and asp.net updatepanel

The .valid() function checks whether the form is valid.  In .net world, you can add a "OnClientClick" event to your submitting events that "returns" true or false for the validity of the form.

<asp:Button runat="server" id="btnFormUpdate" Text="Update" OnClientClick="return isValid()" />

<script>
     function isValid() {
         var v = $("#form1").valid();
         return v;
     }
</script>



This setup will prevent the button from executing the click event based on the validity of the form.
Random Solutions  
 
programming4us programming4us