[英]How to open a new created Model Razor Page in dotnet core razor pages (3.1)
I am starting to develop a new demo from MS Docs Razor Pages with ASP.Net Core 3.1.我开始使用 ASP.Net Core 3.1 从 MS Docs Razor Pages 开发一个新的演示。 I added a new Model Qualification and under Pages the UI by Scaffolding.我添加了一个新的 Model 资格,并在通过脚手架的页面 UI 下。 Now i am trying to open this new model pages through nav-item but in browser it does not open the index.cshtml page because the href is null.现在我正在尝试通过 nav-item 打开这个新的 model 页面,但在浏览器中它不会打开 index.cshtml 页面,因为 href 是 null。 The url https://localhost:44381/qualifications opens the page. url https://localhost:44381/qualifications 打开页面。
Is there anything wrong?有什么问题吗? Thanks a lot for your helps.非常感谢您的帮助。 Bye再见
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-page="/Qualification">Privacy</a>
</li>
So i find the answer.所以我找到了答案。 It nee to reference to a.cshtml file.它需要引用一个.cshtml 文件。
I need to extend the url.我需要扩展 url。
<a class="nav-link text-dark" asp-area="" asp-page="/Qualification/Create">Privacy</a>
If you are using the HTML <a>
tag , use href
:如果您使用的是HTML <a>
标签,请使用href
:
<a href="/Qualifications">Privacy</a>
If you want to use the .NET Core anchor tag helper , you need to specify both area name and page name:如果要使用.NET Core 锚标签助手,则需要同时指定区域名称和页面名称:
<a asp-area="Qualifications" asp-page="/Index">Privacy</a>
Note: the area name, from your project structure, should be Qualifications
(not Qualification
).注意:区域名称,来自您的项目结构,应该是Qualifications
(不是Qualification
)。
You may check out the documentation on the official documentation for the details.您可以查看官方文档中的文档了解详细信息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.