Ajax.ActionLink使用在提交参数明确的状况下,如:ajax
Ajax.ActionLink("加入购物车", "AddToCart", "Cart", new { GoodsId = 3, Amount = 10 }, ajaxOption, new { @class = "btn" })orm
这里的提交参数GoodsId及Amount值是可肯定的。input
Ajax.BeginForm使用在提交参数可能变化的场所,好比参数的值是用户选择的。如:it
@using (Ajax.BeginForm("AddToCart", "Cart", ajaxOption))
{io
<input name="GoodsId" id="GoodsId" value="@Model.Goods.First().Id" type="hidden">class
<input name="Amount" id="Amount" value="1" type="text">new
<input id="addtocart" class="btn" type="submit" value="加入购物车" />参数
}