gpt4 book ai didi

asp.net-mvc - 在 MVC 核心应用程序中创建母版页

转载 作者:行者123 更新时间:2023-12-02 17:08:38 25 4
gpt4 key购买 nike

我保证我是 MVC Core 的新手(我只有 1 周的练习时间)我知道如何将母版页添加到 Dot net 框架而不是 MVC Core。谁能帮我?谢谢

最佳答案

Layout Page Structure (Layout1.cshtml)

<!DOCTYPE html>  
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
@RenderSection("head", false)
</head>
<body>

@Html.ActionLink("Home", "Index", "My") |
@Html.ActionLink("AboutUs", "AboutUs", "My") |
@Html.ActionLink("ContactUS", "ContactUS", "My") |
@Html.ActionLink("Facebook", "Facebook", "My") |
@Html.ActionLink("Twitter", "Twitter", "My")

<br />
@RenderBody()
<br />

Hello Nitin Pandit…………This is the demo of Layout pages.

</body>
</html>

Set the Layout Page of your view when creating of your action method view

@{
Layout = "~/Shared/_Layout1.cshtml";
}

关于asp.net-mvc - 在 MVC 核心应用程序中创建母版页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50446336/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com