Hi, having some trouble with setting up a multiple media picker within a switch block.
Razor is new to me and I could use a little help referencing the images. im getting the node id's but cant seem to get correct razor to display the image.
Any help would be grateful.
@{var widgetsFolder = Model.WidgetsFolders.Where("Visible").First();} @foreach (dynamic widget in widgetsFolder.Children.Where("Visible and nodeTypeAlias.StartsWith(\"Widget_\")")) { string widgetType = widget.NodeTypeAlias.ToString(); switch (widgetType) { case "Widget_LogoList": @showLogos(widget); break; default: <b>Unknown Widget!</b> break; } } @helper showLogos(dynamic widget) { @* @widget.logoItem; - OUTPUTS ID OF IMAGE NODE *@ if (!string.IsNullOrEmpty(Model.logoItem.ToString())) { dynamic mediaItem = Library.MediaById(Model.logoItem); <img src="@mediaItem.umbracoFile" alt="@mediaItem.Name" /> } }
Multi Media Picker
Hi, having some trouble with setting up a multiple media picker within a switch block.
Razor is new to me and I could use a little help referencing the images. im getting the node id's but cant seem to get correct razor to display the image.
Any help would be grateful.
@{var widgetsFolder = Model.WidgetsFolders.Where("Visible").First();}@foreach (dynamic widget in widgetsFolder.Children.Where("Visible and nodeTypeAlias.StartsWith(\"Widget_\")")) {
string widgetType = widget.NodeTypeAlias.ToString();
switch (widgetType) {
case "Widget_LogoList":
@showLogos(widget);
break;
default:
<b>Unknown Widget!</b>
break;
}
}
@helper showLogos(dynamic widget) {
@* @widget.logoItem; - OUTPUTS ID OF IMAGE NODE *@
if (!string.IsNullOrEmpty(Model.logoItem.ToString()))
{
dynamic mediaItem = Library.MediaById(Model.logoItem);
<img src="@mediaItem.umbracoFile" alt="@mediaItem.Name" />
}
}
Somehow got it working
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.