In this example my Model has children of the type article (that's the alias of the DocType) and I'm requesting them all (hence the pluralization).
I am trying to d the same thing as their example here:
<div class="slideshow"> @foreach(var slideshow in Model.slideshows) { <p>@slideshow.Name</p> } </div>
where I have a Document type with alias "slideshow" but it is throwing the error:
"Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'umbraco.MacroEngines.DynamicNode' does not contain a definition for 'slideshows' at CallSite.Target(Closure , CallSite , Object ) at....."
It's working for me now. It was an issue with case. I had to use:
@foreach(var slidehsow inModel.Slideshows){
and then it worked. The strange part was that my doctype was defined with an alias of 'slideshow' (all lowercase). I went ahead and changed the doctype alias to 'Slideshow' so that it matches my Razor code and its still working. I don't fully understand why but glad its working now.
Requesting specific types of children with Razor
I read on this blog (http://www.aaron-powell.com/umbraco-4-and-razor ) that you can loop though specific types of chidlren like so:
In this example my
Model
has children of the typearticle
(that's the alias of the DocType) and I'm requesting them all (hence the pluralization).I am trying to d the same thing as their example here:
<div class="slideshow">
@foreach(var slideshow in Model.slideshows) {
<p>@slideshow.Name</p>
}
</div>
where I have a Document type with alias "slideshow" but it is throwing the error:
"Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'umbraco.MacroEngines.DynamicNode' does not contain a definition for 'slideshows' at CallSite.Target(Closure , CallSite , Object ) at....."
Any ideas what I am doing wrong?
It's working for me now. It was an issue with case. I had to use:
and then it worked. The strange part was that my doctype was defined with an alias of 'slideshow' (all lowercase). I went ahead and changed the doctype alias to 'Slideshow' so that it matches my Razor code and its still working. I don't fully understand why but glad its working now.
Thanks!
is working on a reply...