I cant figure out why this script does not work. I get this error when I debug in Visual Studio:
Cannot implicitly convert type 'umbraco.MacroEngines.DynamicNode' to 'System.Collections.IEnumerable'. An explicit conversion exists (are you missing a cast?).
The error is shown on "foreach".
What I want the script to do is showing multiple images with DAMP Classic. (No crop etc.)
You can't use the foreach here because Model.MediaById will only return 1 object and not something which is enumerable. If you make sure that the DAMP Classic can only select 1 media item which stores the id something like this should work:
var media = Model.MediaById(Model.imageDamp); <img src="@media.umbracoFile" alt="@media.nodeName"/>
Showing multiple images with DAMP
Hi
I cant figure out why this script does not work. I get this error when I debug in Visual Studio:
Cannot implicitly convert type 'umbraco.MacroEngines.DynamicNode' to 'System.Collections.IEnumerable'. An explicit conversion exists (are you missing a cast?).
The error is shown on "foreach".
What I want the script to do is showing multiple images with DAMP Classic. (No crop etc.)
Thanks in advance!
//René
You can't use the foreach here because Model.MediaById will only return 1 object and not something which is enumerable. If you make sure that the DAMP Classic can only select 1 media item which stores the id something like this should work:
Jeroen
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.