【问题标题】:Form Tag Helper not generate correct HTML (areas ?)表单标记助手无法生成正确的 HTML(区域?)
【发布时间】:2017-03-26 20:43:29
【问题描述】:

关于ASP.NET Core 1.1.1的官方信息 https://docs.microsoft.com/en-us/aspnet/core/mvc/views/working-with-forms

表单标签助手应该生成一些有效的 mvc HTML。

但由于某种原因,我位于某个区域的观点从未这样做 我看到输出 HTML 像

<form asp-controller="Account" asp-action="Register" method="post" class="form-horizontal">

我的 _ViewImports.cshtml 是共享的(全局 - 区域内没有 1 个文件):

   @using ATA
    @using ATA
    @using ATA.Security.Models.AccountViewModels
    @using ATA.Security.Models.ManageViewModels
    @using Microsoft.AspNetCore.Identity
    @addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers"
    @addTagHelper "*, ATA.Security"

" - 是我添加的,但 html 输出结果没有区别,如果我重新修改它

这种情况可能是什么问题?

【问题讨论】:

  • 请不要将 ASP.NET Core 和 .NET Core 互换使用!!! ASP.NET Core 是一个 Rest Api/MVC webstack,.NET Core 是一个运行时。您的问题无论如何都与运行时有关

标签: asp.net-core tag-helpers


【解决方案1】:

我在将 _ViewImports.cshtml 推送到 View 文件夹时解决了这个问题。 好像不支持分享 _ViewImports.cshtml 文件

【讨论】:

  • 如果您将视图重新组织到基于功能的文件夹结构中,请不要忘记这样做。
猜你喜欢
  • 2020-10-25
  • 1970-01-01
  • 1970-01-01
  • 2022-06-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-12-30
相关资源
最近更新 更多