: 2009-11-21
MVC Release 2 Preview 2 , .
MVC Release 2 Preview 1.
, .
: 2009-08-07
MVC Release 2 Preview 1 , .
script MicrosoftMvcAjax.debug.js, _serializeSubmitButton, , Ajax.BeginForm() , onclick, , " Microsoft JScript:" Sys.Mvc.AsyncForm " ".
, , , - . , , Ajax Forms , .
: 2009-05-07
Microsoft, , . , , .
, Microsoft. , , , , .
Ajax MVC. , , :
<% using (Ajax.BeginForm("Action", "Controller",
new AjaxOptions { UpdateTargetId = "MyControl", HttpMethod = "POST"}))
{ %>
<span id="MyControl">
<% Html.RenderPartial("MyControl"); %>
</span>
<% } %>
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<input name="startIndex" type="hidden" value="0" />
<%= Ajax.ActionLink("Prev", "PrevAction",
new AjaxOptions() { UpdateTargetId="MyControl", HttpMethod="POST"}) %>
<%= Ajax.ActionLink("Next", "NextAction",
new AjaxOptions() { UpdateTargetId="MyControl", HttpMethod="POST"}) %>
:
, .
. 2 "Prev" "Next". "Prev" PrevAction , "startIndex" . "".
Actual:
, NONE , , POST.
- , ActionLink, . , URL- , POST.
JavaScript?
javascript, , , , . , -, , , , Internet Explorer.
, , , - Ajax.BeginForm() onsubmit(), . , onsubmit() , .
MicrosoftMvcAjax , , , . , WC3 . , . Internet explorer , , script .
( Firefox "explictOriginalTarget", , )
?
Microsoft . , - , , MicrosoftMvcAjax -. , mousedown, , onsubmit .
, , . , IE8, FireFox, MVC Ajax... . .
<script type="text/javascript">
var _clicked = "";
function onSubmit(e) {
var targ;
if (!e) var e = window.event;
if (e.target) targ = e.target;
else if (e.srcElement) targ = e.srcElement;
if (targ.nodeType == 3)
targ = targ.parentNode;
alert("OnSubmit:" + _clicked + " was clicked.");
return false;
}
function Click(e) {
var targ;
if (!e) var e = window.event;
if (e.target) targ = e.target;
else if (e.srcElement) targ = e.srcElement;
if (targ.nodeType == 3)
targ = targ.parentNode;
_clicked = targ.name;
return true;
}
<form action="/Home/StandardForm" method="post"
onsubmit="onSubmit(event)" onmousedown="Click(event)">
<input type="submit" name="StdPrev" value="StdPrev" />
<input type="submit" name="StdNext" value="StdNext" />
</form>