Umbraco Razor code breaks when wrapping a Div round the multiURL picker -
when wrapping multiurl picker within div tag, breaks page, has seen type of behaviour before when creating new templates in umbraco?
if has experienced before , can share fix, appreciated.
@inherits umbraco.web.mvc.umbracotemplatepage @using archetype.models; @using archetype.extensions; @using rjp.multiurlpicker.models; @{ layout = "master.cshtml"; } <div class="container"> <div class="row"> <h1>@umbraco.field("pagetitle")</h1> <p>@umbraco.field("pagebodytext")</p> @foreach (var fieldset in model.content.getpropertyvalue<archetypemodel>("box")) { <div class="this-div"> <h3>@fieldset.getvalue("boxtitle")</h3> <img src="@umbraco.typedmedia(fieldset.getvalue("boximage")).url" /> var multiurlpicker = fieldset.getvalue<multiurls>("boxlink"); if (multiurlpicker.any()) { <ul> @foreach (var item in multiurlpicker) { <li><a href="@item.url" target="@item.target">@item.name</a></li> } </ul> } </div> }
i think line starting var multiurlpicker being interpreted html , not code, try wrapping code between @{ , }
<div class="this-div"> @{ var multiurlpicker = fieldset.getvalue<multiurls>("boxlink"); if (multiurlpicker.any()) { <ul> @foreach (var item in multiurlpicker) { <li><a href="@item.url" target="@item.target">@item.name</a></li> } </ul> } } </div>
Comments
Post a Comment