点击图标显示另一个视图时遇到问题。
这是我的标记:
<h4 class="form-control-static ng-cloak">{{selectedFacility.Name}} <a href="@Url.Action("GetRrfForm","FacilityAdd")"><img src="/Content/PurchaseOrder.ico" style="width:30px;height:22px;margin-top:5px"> </a></h4>
我的控制器中的操作方法:
public class FacilityAddController : Controller
{
public ActionResult GetRrfForm()
{
return View("ItemAddPopup");
}
}
我还尝试使用Url.RouteUrl()
:
routes.MapRoute(
"ItemEdit",
"{controller}/{action}",
new { controller = "FacilityAdd", action = "GetRrfForm"}
);
<a href="@Url.RouteUrl("ItemEdit", new { controller = "FacilityAdd", action = "GetRrfForm"})"><img src="/Content/PurchaseOrder.ico" style="width:30px;height:40px;margin-top:5px"> </a>
答案 0 :(得分:0)
View("~/Views/Home/ItemAddPopup.cshtml")
应该只是
View("ItemAddPopup")
您指定视图的名称,而不是路径,如下所示:
http://msdn.microsoft.com/en-us/library/system.web.mvc.controller.view%28v=vs.118%29.aspx