【问题标题】:How to specify specific controller from View如何从视图中指定特定的控制器
【发布时间】:2021-07-30 06:12:32
【问题描述】:

我正在使用 .net 核心 MVC 应用程序。如果我没有指明 asp-controller="DealController",那么操作会转到 UserController,因为调用发生在 user.cshtml 中。但是当我指定一个特定的Controller时,调用仍然没有转到DealController。请告诉我我做错了什么。

 <form asp-route-empname="@deal.Id" asp-controller="DealController" asp-action="DeleteDeal" method="post">
    <button type="submit">Delete</button>
    </form>

【问题讨论】:

    标签: c# asp.net-mvc .net-core razor-pages


    【解决方案1】:

    删除控制器名称中的“Controller”部分:

    <form asp-route-empname="@deal.Id" asp-controller="Deal" asp-action="DeleteDeal" method="post">
    

    【讨论】:

      猜你喜欢
      • 2012-08-11
      • 2012-02-11
      • 1970-01-01
      • 1970-01-01
      • 2011-01-07
      • 1970-01-01
      • 1970-01-01
      • 2012-07-08
      • 1970-01-01
      相关资源
      最近更新 更多