I am assuming there is a way to set a default layout to use if one is not selected, but I cant seem to find any documentation on it.
From the controller, if I call return View()
it returns the page without any of the html from the layout. If i return the view as follows, the layout shows up fine.
return View("Index", "~/Views/Shared/_PublicLayout.cshtml");
So I'm wondering if there is a way to set the default variable for the layout so i don't have to specify it every time for every view.
In the views folder locate or create file _ViewStart.cshtml
and inside you can define:
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
where _Layout.cshtml
is your default layout.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With