1
votes

When wrapping my MultiURL picker within a div tag, it breaks the page, has anyone seen this type of behaviour before when creating new templates in Umbraco?

If anyone has experienced this before and can share a fix, that would be much 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>

}
1

1 Answers

3
votes

I think that the line starting with var multiUrlPicker is being interpreted as html and not as code, try wrapping your code between @{ and }

<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>