Take the community feedback survey now.
AI OnAI Off
Take the community feedback survey now.
Hi,
looks correct to me. Make sure that you've put '@Html.RequiredClientResources("Footer")' at the bottom of the layout view though, as the scripts will be rendered at the location where you've put it.
Thanks for your response, Per. I have declared the footer area just before the closing body tag. Here is some of my markup:
_Blank.cshtml Layout:
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title></title>
@Scripts.Render("~/bundles/js")
@Html.RequiredClientResources("Header") @*Enable components to require resources. For an example, see the view for VideoBlock.*@
</head>
<body>
<div>
@RenderBody()
</div>
@Html.RequiredClientResources("Footer")
</body>
</html>
Page:
@model PageViewModel<CampWeekAdminPage, CampWeekAdminViewModel>
@{
Layout = "~/Views/Shared/Layouts/_Blank.cshtml";
EPiServer.Framework.Web.Resources.ClientResources.RequireScript("/ClientResources/js/jQuery/jquery.tlgi.validation.js").AtFooter();
var cwVM = Model.ViewModel;
}
Yesterday, right before I left, the script was appearing in the <head> section when rendered, even after rebuilding the project and doing a hard refresh on the page. Now, when I just ran it to confirm it's not working, it's now appearing at the footer. Something must have been cached. Where or how it got cleared, I don't know. Thanks for confirming all was correct.
What area name does the .AtFooter() method look for? I have @Html.RequiredClientResources("Footer") in my master page, but my script is added to the page
even when using .AtFooter(). The only documentation I can find on this whole feature shows the use of @Html.RequiredClientResources(RenderingArea.Footerbody) but I can't find anywhere where RenderingArea.Footerbody is defined.