开发者

Does InsertMode.Replace replace the content or the whole element?

开发者 https://www.devze.com 2023-03-13 15:32 出处:网络
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?

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消