我目前有一个使用.net页面的.net核心web应用程序(RazorCore3.1)。我有以下文件夹结构。
Areas (folder)
Users (folder)
Pages (folder)
Index.cshtml
Edit.cshtml 在Index.cshtml中,我有下面的视图代码。当应用程序运行时,它没有生成href,当我检查html时,它生成html,如下所示:
<a class="nav-link text-dark" asp-area="Users" asp-page="/Edit" asp-route-id="56591c1d-88af-48b6-b41b-1948af412511">Edit</a>
@page
@model MyApp.Areas.User.Pages.IndexModel
@{
ViewData["Title"] = "Users";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h1>Users</h1>
<table class="table">
<thead>
<tr>
<th>Operations</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.Users)
{
<tr>
<td>
<a class="nav-link text-dark" asp-area="Users" asp-page="/Edit" asp-route-id="@item.UserId">Edit</a> |
</td>
</tr>
}
</tbody>
</table>发布于 2020-09-13 02:14:39
我很怀念_ViewImports.cshtml
@using MyApp.Areas.Users
@using MyApp.Areas.Users.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpershttps://stackoverflow.com/questions/63863306
复制相似问题