Does InsertMode.Replace replace the content or the whole element?
In MVC 3, there is an option to specify the type of replacement when using Ajax.BeginForm
. Does it replace the content of the element that you specify in UpdateTargetId
or the element as a whole?
@using (Ajax.BeginForm("action", "controller", new AjaxOptions
开发者_JS百科 {
UpdateTargetId = "TargetElementId",
HttpMethod = "POST",
InsertionMode = InsertionMode.Replace,
}, new { @id = "FormId" }))
{
}
It replace the content of the element. Not the element as a whole. In your case replace content inside element with id = "TargetElementId".
common element used is DIV!
It replaces the content within that element, but not the element itself. This makes it ideal to use when you want to use the same code to repeatedly 'update' that element's content with the current query, each time you might submit it.
精彩评论