ajax.actionlink替换vs替换 [英] ajax.actionlink replace vs replacewith
问题描述
我在ASP.NET-MVC应用程序中使用的视图中正在使用Ajax.ActionLink
,并且正在使用InsertionMode.Replace
,但是我看到还有一个ReplaceWith
选项.两者有什么区别?一个替代品是否比另一个替代品更多/更少.我需要将要替换的div完全替换为局部视图.
I'm using Ajax.ActionLink
in a view that I have on an ASP.NET-MVC application and I'm using InsertionMode.Replace
, but I see there's also a ReplaceWith
option. What's the difference between the two? Does one replace something more/less than the other one. I need the div I'm replacing to be completely replaced with the partial view.
我在Google的任何地方都找不到比较
I can't find a comparison anywhere on google
推荐答案
Replace
将内容替换为新内容. ReplaceWith
将替换整个元素.
Replace
will replace the content with the new content. ReplaceWith
will replace the entire element.
<body>
<div id="myResults">
<p> Results will be displayed here </p>
</div>
</body>
ajax的响应
<span>This is the result</span>
具有Replace
选项且定位myResults
<body>
<div id="myResults">
<span>This is the result</span>
</div>
</body>
使用ReplaceWith
选项定位myResults
<body>
<span>This is the result</span>
</body>
这篇关于ajax.actionlink替换vs替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!