We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to enable the Unobtrusive Jquery validation for a form in MVC on page transfer?

In MVC, form validation is achieved by using its built-in jquery unobtrusive validation. The form validation does not work when a page is transferred via the Ajax request. You can enable the validation in the viewtransfer event. To achieve this, refer to the following steps.

  1. Create a model file to the application. This consists of jquery validation rules. You can refer to the following code example. 


public class Sample



        public string Name { get; set; } 



        public string Email { get; set; }


  1. Create the form with unobtrusive error message. Refer to the following code example.



    @Html.LabelFor(model => model.Name)

    @Html.TextBoxFor(model => model.Name)

    @Html.ValidationMessageFor(model => model.Name)

    <br />

    @Html.LabelFor(model => model.Email)

    @Html.TextBoxFor(model => model.Email)

    @Html.ValidationMessageFor(model => model.Email)

    <br />

    <input type="submit" value="Submit" />


  1. To enable form validation after the Ajax page transfer, add the following script code to the active page. This recalibrates all the validators of the form elements when content is added dynamically.



    $(document).bind("viewtransfer", function () {







Article ID: Published Date: Last Revised Date: Platform: Control:
4101 02/19/2015 02/19/2015 ASP.NET MVC General
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Please sign in to access our KB

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon