I'm loading partial views which are ajax Forms. They look like this
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<WebGRC.Web.Controllers.Models.Administration.UserAdminModel>" %>
<%@ Import Namespace="WebGRC.Web.Controllers.Models.User" %>
<h2><%=Html.Encode(ViewData["HeaderText"])%></h2>
<% Html.EnableClientValidation(); %>
<% using (Ajax.BeginForm(ViewData["PostAction"].ToString(), "Administration",
new AjaxOptions() {
HttpMethod = "Post",
UpdateTargetId = "admin-main"
}))
{ %>
<%= Html.ValidationSummary(true, ViewData["ValidationSummaryText"].ToString()) %>
<div>
<fieldset>
<legend>Informations Système</legend>
<%= Html.EditorFor(model=>model.Username)%>
<%= Html.EditorFor(model=>model.Email)%>
<%= Html.Encode(ViewData["PasswordText"])%>
<br />
<%= Html.EditorFor(model=>model.Password)%>
<%= Html.EditorFor(model=>model.ConfirmPassword)%>
</fieldset>
<%--<%= Html.EditorFor(model=>model.UserInfo) %>--%>
<p>
<input type="submit" value="Register" />
</p>
</div>
<% } %>
The main form which is Index.aspx looks like this
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="WebGRC.Web.Controllers" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<link href="<%= ResolveUrl("~") %>Public/css/Site.css" rel="stylesheet" type="text/css" />
<link href="<%= ResolveUrl("~") %>Public/css/jqueryslidemenu.css" rel="stylesheet" type="text/css" />
<!--[if lte IE 7]>
<style type="text/css">
html .jqueryslidemenu{height: 1%;} /*Holly Hack for IE7 and below*/
</style>
<![endif]-->
<title>GRC</title>
</head>
<body>
<div class="page">
<div id="header">
<div id="title">
<h1>GRC</h1>
</div>
<div id="toolbarcontainer">
<% Html.RenderAction<MenuController>(m => m.MainToolBar());%>
</div>
<div id="menucontainer" class="jqueryslidemenu">
<% Html.RenderAction<MenuController>(m => m.MainMenu());%>
</div>
</div>
<div id="app-main">
<% Html.RenderAction<HomeController>(c=>c.ShowHome()); %>
</div>
<div id="footer">
</div>
</div>
<script type="text/javascript" src="../../Public/javascript/MicrosoftAjax.js"></script>
<script type="text/javascript" src="../../Public/javascript/MicrosoftMvcAjax.js"></script>
<script type="text/javascript" src="../../Public/javascript/MicrosoftMvcValidation.js"></script>
<script type="text/javascript" src="../../Public/javascript/jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="../../Public/javascript/jquery.validate.min.js"></script>
<script type="text/javascript" src="../../Public/javascript/MicrosoftMvcJQueryValidation.js"></script>
<script type="text/javascript" src="../../Public/javascript/jqueryslidemenu.js"></script>
<script type="text/javascript" src="../../Public/javascript/GRC.js"></script>
</body>
</html>
I get this generated in the html
<![CDATA[
3if (!window.mvcClientValidationMetadata) { window.mvcClientValidationMetadata = []; }
4window.mvcClientValidationMetadata.push({"Fields":[{"FieldName":"Username","ReplaceValidationMessageContents":true,"ValidationMessageId":"Username_validationMessage","ValidationRules":[{"ErrorMessage":"Le nom d\u0027utilisateur est requis.","ValidationParameters":{},"ValidationType":"required"}]},{"FieldName":"Email","ReplaceValidationMessageContents":true,"ValidationMessageId":"Email_validationMessage","ValidationRules":[{"ErrorMessage":"L\u0027email est requis.","ValidationParameters":{},"ValidationType":"required"}]},{"FieldName":"Password","ReplaceValidationMessageContents":true,"ValidationMessageId":"Password_validationMessage","ValidationRules":[{"ErrorMessage":"Le mot de passe est requis.","ValidationParameters":{},"ValidationType":"required"}]},{"FieldName":"ConfirmPassword","ReplaceValidationMessageContents":true,"ValidationMessageId":"ConfirmPassword_validationMessage","ValidationRules":[{"ErrorMessage":"Le mot de passe est requis.","ValidationParameters":{},"ValidationType":"required"}]}],"FormId":"form0","ReplaceValidationSummary":false,"ValidationSummaryId":"validationSummary"});
5//]]>
But when i click submit the form get submitted to the server and no client side validation is occuring ?
What i'm i missing here ? thanks