To get a recursive value in Razor, where i move up to parent node, to see if this has value for a property, i can use the code below.
var eventLocation = @Model.AncestorsOrSelf().Where("eventLocation.ToString() != string.Empty").Last().eventLocation;
But i dosnt work when the property uses a Date Picker. How do i check the propertys value to see if its set or not? Comparing it against an empy string, dosnt work.
Recursive DatePicker value In Razor
Hi,
To get a recursive value in Razor, where i move up to parent node, to see if this has value for a property, i can use the code below.
But i dosnt work when the property uses a Date Picker.
How do i check the propertys value to see if its set or not?
Comparing it against an empy string, dosnt work.
Anyone who can help me solve this?
Hi all,
Finally i found the solution, here it is for others.
@inherits umbraco.MacroEngines.DynamicNodeContext
@using umbraco.MacroEngines;
@using uComponents.Core.DataTypes.MultiUrlPicker.Dto;
@{
MultiUrlPickerState selectedLinks = GlobalHelpers.GetMultiUrlPickerState(Model.GetProperty("topNavigationLinks", true).Value);
if (selectedLinks.Items.Any())
{
foreach (var link in selectedLinks.Items)
{
var target = link.NewWindow ? "target=\"_blank\"" : "";
<li><a href="@link.Url"@target>@link.Title</a></li>
}
}
//<multi-url-picker><url-picker mode="URL"><new-window>False</new-window><node-id /><url>http://www.domain1.com</url><link-title>Name1</link-title></url-picker><url-picker mode="URL"><new-window>False</new-window><node-id /><url>domain2</url><link-title>name2</link-title></url-picker></multi-url-picker>
}
is working on a reply...