Reputation: 2440
I promise I am complete newbie to MVC Core (I have only 1 week practice) I know how to add a master page to a Dot net framework but not to MVC Core. Can anyone help me? Thanks
Upvotes: 2
Views: 5487
Reputation: 1805
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";
}
Upvotes: 6