Пример прилагается:
Частичная:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<div id="subContent">
<fieldset>
<legend>Subscribe</legend>
<form id="subForm" method="post" action="<%= Url.Action("Subscribe") %>">
<%= Html.ValidationSummary("Subscribe was unsuccessful. Please correct the errors and try again.") %>
<input type="text" name="name" id="name" /><%= Html.ValidationMessage("name", "*") %>
<input type="submit" />
</form>
</fieldset>
</div>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$('#subForm').live('submit', function() {
$.post($(this).attr('action'), $(this).serialize(), function(data) {
$("#subContent").replaceWith($(data));
});
return false;
});
});
</script>
Контроллер:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Subscribe(string name)
{
ModelState.AddModelError("name", "You must enter a name");
return PartialView("SubscribeForm");
}