I have a layout page that has variables that need to be filled. Example:
@ModelType KarateAqua.schoolModel
<html>
<body>
@RenderBody()
<div id="footer">
<div class="content">
<div class="bottom_logo">
<a href="/"><span class="inv">@Model.schoolName</span></a>
</div>
</div>
</div>
</body>
</html>
I don’t want to populate this in every ActionResult. Is there a way to pass data to a layout page once and do it for all instances?
OK since you want this to be set once you can make use of a partial view. However depending on your needs you will need to have several partial views (may be not ideal if sections are going to be scattered across the _layout page)
your partial view will look like
Controller
in your _layout.cshtml place this line where you want to have the partial view to be inserted