【问题标题】:How to let partial view call the action of the controller in area using "@Url.Action"如何让局部视图使用“@Url.Action”调用区域中控制器的动作
【发布时间】:2015-03-15 12:12:31
【问题描述】:

我试图让局部视图(_CartPartial.cshtml)使用“@Url.Action”调用区域中控制器(OrderController.cs)的动作。

但是浏览器显示:Not Found View: 'Index'。

代码如下:

_CartPartial.cshtml

**<a id="CartDropDown" class="btn-group btn-group-lg" href="@Url.Action("Index", "Order", new { })">

</a>**

OrderController.cs

**public class OrderController : Controller
    {
        // GET: Order
        public ActionResult Index()
        {
            return View();
        }
        [HttpPost]
        public ActionResult Index( Models.Order.Ship postback )
        {
            return View();
        }
    }
}**

文件夹如下:

【问题讨论】:

    标签: asp.net-mvc-5


    【解决方案1】:

    你会用吗

    @html.ActionLink("link text", "Action Name", "Controller Name");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-01-14
      • 1970-01-01
      • 2010-11-25
      • 2022-12-15
      • 1970-01-01
      • 2013-10-30
      • 2021-12-19
      • 1970-01-01
      相关资源
      最近更新 更多