ASP.NET Core 2.1奇怪的子菜单出现在“管理"页面中 [英] ASP.NET Core 2.1 strange submenu appears in Manage page

查看:81
本文介绍了ASP.NET Core 2.1奇怪的子菜单出现在“管理"页面中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的Scaffolded Identity生成的管理"页面.

This is my Manage page that was generated by the Scaffolded Identity.

以前这很奇怪,带有副标题管理您的帐户标题":更改帐户设置"和菜单"没有出现.

Previously this weird Manage your account header with the subheading: Change your account settings and menu did not appear.

唯一显示的是图像中的表单以及位于表单正上方的管理帐户"标题,但是我不确定为什么突然出现此多余的标题和菜单.我尝试在页面本身上进行搜索,但未在代码中显示.这是某处的配置吗?

The only thing that showed was the form in the image and the Manage Account header located directly above the form but I'm not sure why suddenly this extra header and menu appears. I've tried searching on the page itself but it doesn't show up in the code. Is this a configuration somewhere?

添加了管理"结构

推荐答案

您可以尝试打开文件夹Manage中的文件_Layout.cshtml,也许是这样的:

You can try to open the file _Layout.cshtml in the folder Manage, maybe there is something like this:

<h2>Manage your account</h2>

<div>
    <h4>Change your account settings</h4>
    <hr />
    <div class="row">
        <div class="col-md-3">
            <partial name="_ManageNav" />
        </div>
        <div class="col-md-9">
            @RenderBody()
        </div>
    </div>
</div>

@section Scripts {
    @RenderSection("Scripts", required: false)
}


根据您的更新,我认为问题出在添加脚手架项目的方式上.


Based on your update, I think the problem comes from the way you add scaffolded item.

我建议您按照以下步骤添加所有脚手架物品,然后删除不使用的物品.

I suggest you to follow these steps to add all scaffolded items, then deleting which one you don't use.

  1. 右键单击解决方案->添加->新脚手架项目...->身份->身份->添加

  1. Right-click on the solution -> Add -> New Scaffolded Item... -> Identity -> Identity -> Add

选中以下选项:Override all files.

  1. 在布局输入中,单击...按钮以选择默认布局:
  1. In the layout input, clicking on the ... button to select the default layout:

  1. Data context class输入中,单击+按钮以创建新的上下文类:
  1. In the Data context class input, clicking on + button to create new context class:

搭棚之后,您将收到所有文件:

After scaffolding, you will receive all the files:

最后,您可以打开文件_Layout.cshtml来检查标题,文件内容可能是:

Lastly, you can open the file _Layout.cshtml to check the title, the file content could be:

@{ 
    Layout = "/Areas/Identity/Pages/_Layout.cshtml";
}

<h2>Manage your account</h2>

<div>
    <h4>Change your account settings</h4>
    <hr />
    <div class="row">
        <div class="col-md-3">
            <partial name="_ManageNav" />
        </div>
        <div class="col-md-9">
            @RenderBody()
        </div>
    </div>
</div>

@section Scripts {
    @RenderSection("Scripts", required: false)
}

这篇关于ASP.NET Core 2.1奇怪的子菜单出现在“管理"页面中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆