


















Ajax.ActionLink使用在提交参数明确的情况下,如:
Ajax.ActionLink("加入购物车", "AddToCart", "Cart", new { GoodsId = 3, Amount = 10 }, ajaxOption, new { @class = "btn" })
这里的提交参数GoodsId及Amount值是可确定的。
Ajax.BeginForm使用在提交参数可能变化的场所,比如参数的值是用户选择的。如:
@using (Ajax.BeginForm("AddToCart", "Cart", ajaxOption))
{
<input name="GoodsId" id="GoodsId" value="@Model.Goods.First().Id" type="hidden">
<input name="Amount" id="Amount" value="1" type="text">
<input id="addtocart" class="btn" type="submit" value="加入购物车" />
}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。