如何让部分视图使用" @ Url.Action"来调用区域内控制器的动作

时间:2015-03-15 03:14:06

标签: asp.net-mvc-5

我试图让部分视图(_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();
        }
    }
}**

文件夹如下所示:

enter image description here

1 个答案:

答案 0 :(得分:0)

你能用

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