【问题标题】:Html.Action with attribute routing带有属性路由的 Html.Action
【发布时间】:2015-02-20 21:32:32
【问题描述】:

我的路由属性如下所示

   [RouteArea("Settings")]
   [RoutePrefix("Stores")]
 public class SettingsMallStoresController : Controller
    {
    [HttpGet]
    [Route("ExistingStores/{Permalink}")]
    public ActionResult GetExistingStoreBranchesForSelectedHO(string permalink)
    {
         return View("ExistingStoreBranches");
    }
}

我正在尝试使用 @html.action 从 View 调用此操作

@Html.Action("Settings/Stores/ExistingStores/{Permalink}",new{permalink=Somevalue})

无论如何都无法让它工作。请帮助

【问题讨论】:

    标签: asp.net-mvc razor attributerouting


    【解决方案1】:

    这个对我有用。仍然不确定如何使用属性路由而不是直接调用控制器操作。更好的方法是可行的 @Html.Action("GetExistingStoreBranchesForSelectedHO", new { Controller = "SettingsMallStores", Action = "GetExistingStoreBranchesForSelectedHO" })

    【讨论】:

      猜你喜欢
      • 2021-06-01
      • 2019-05-10
      • 1970-01-01
      • 2016-07-16
      • 2016-01-18
      • 2011-05-23
      • 2015-06-21
      • 2018-07-18
      • 2015-10-09
      相关资源
      最近更新 更多