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" >

                 <input name="Amount" >

                 <input />

             }

 

相关文章:

  • 2022-12-23
  • 2021-10-26
  • 2022-12-23
  • 2021-06-12
  • 2021-05-28
  • 2021-11-02
  • 2022-01-19
  • 2022-12-23
猜你喜欢
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
  • 2021-09-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
相关资源
相似解决方案