Is MVC 2 client-side validation broken in Visual Studio 2010 RC?

Posted by Will on Stack Overflow See other posts from Stack Overflow or by Will
Published on 2010-03-25T19:53:09Z Indexed on 2010/03/25 20:03 UTC
Read the original article Hit count: 351

I can't seem to get client side validation working with the version of MVC released with Visual Studio 2010 RC.

I've tried it with two projects -- one upgrade from 1.0, and one using the template that came with VS.

I'd think the template version would work, but it doesn't. Added the following scripts:

<script type="text/javascript" 
  src="<%= Url.Content("~/Scripts/MicrosoftMvcValidation.js") %>">
</script>
<script type="text/javascript" 
  src="<%= Url.Content("~/Scripts/jquery.validate.js")%>">
</script>

which are downloaded to the client correctly. Added the following to my form page:

<% Html.EnableClientValidation(); %>
<%--yes, am aware of the EndForm() bug! --%>
<% using (Html.BeginForm()) { %>    
<%--snip --%>

and I can see the client validation scripts have been added to the bottom of the form. But still client validation never happens.

What is worse is that in my upgraded project, the client validation scripts are never output in the page!

PLEASE NOTE: I am specifically asking about the version of MVC2 that came with VS2010 RC. Also, I do know how to google; please don't waste anybody's time searching and answering if you aren't familiar with this issue in the release candidate of Visual Studio. Thanks.

© Stack Overflow or respective owner

Related posts about asp.net-mvc2

Related posts about client-side