Search code examples
jqueryajaxasp.net-mvc-3client-side-validation

Ajax.BeignForm() and re-referencing necessary scripts?


I created a partial view which consist of an Ajax.BeignForm(), as far as I read about it, to make client side validation work, I should reference these scripts :

<script src="<%: Url.Content("~/Scripts/jquery-1.5.1.min.js") %>" type="text/javascript"></script>
<script src="<%: Url.Content("~/Scripts/jquery.validate.min.js") %>" type="text/javascript"></script>
<script src="<%: Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js") %>" type="text/javascript"></script>

Even though I already referenced them in view which calls the partial view (the one which consist Ajax.BeignForm()), I should re-reference them. But It made a problem which take two days of me, and cause the problem I described here, and that problem only solves by removing above scripts, And removing them causes the client side validation not to work. Do you have Any Idea ?


Solution

  • Don't forget these guys:

    <configuration>
        <appSettings>
            <add key="ClientValidationEnabled" value="true"/>
            <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
        </appSettings>
    </configuration>