When I try to loop the images under general (id:1) with the following code
@inherits Umbraco.Web.Mvc.UmbracoViewPage<IPublishedContent> @{ var startMedia = Umbraco.TypedMedia(1); } @foreach(var mfile in startMedia.Children()){
var mediaName = mfile.GetPropertyValue("umbracoFile");
<p>@mfile.Id : @mfile.Name : @mediaName</p>
}
It gives me
1 : General :
2 : Project1 :
3 : Project2 :
With TypedContent Im not getting this behavior, there I get the children not the siblings
And even weirder when I change Children() to Descendants() IIS crashes.
This is on a local dev machine. This site is running live on4.7 i took a copy to local machine to make some changes and upgrade everything local before doing it on live site. I upgraded gradually to 4.9 and have been updating everything to Razor macros and everythng works fine. With 4.10 I decided to play with views and maybe make the switch completely to mvc.
All razor macros still work with 4.10 everything works.
This was the first macro i tried to convert to a partial view (it generates some js to have some slideshow in header) The razor macro works perfect it gets the images with children from the startmedia.
v4.10 Umbraco.TypedMedia problem in view
In a 4.10 project I'm playing with views and partial views but i have a weird issue
I'm trying to get all files from a media folder
Media folder is like this :
When I try to loop the images under general (id:1) with the following code
It gives me
With TypedContent Im not getting this behavior, there I get the children not the siblings
And even weirder when I change Children() to Descendants() IIS crashes.
This is on a local dev machine.
This site is running live on4.7 i took a copy to local machine to make some changes and upgrade everything local before doing it on live site.
I upgraded gradually to 4.9 and have been updating everything to Razor macros and everythng works fine.
With 4.10 I decided to play with views and maybe make the switch completely to mvc.
All razor macros still work with 4.10 everything works.
This was the first macro i tried to convert to a partial view (it generates some js to have some slideshow in header) The razor macro works perfect it gets the images with children from the startmedia.
Anyone have a clue what I am doing wrong?
Is there already an documentation to find?
Same happens on a clean install of 4.10
i just create a simple document type with razor template
in the template I get a TypedMedia of a media folder with 3 images when doing getting the children i get the children of the parent.
trying to get Descendants will crash IIS also
Should i get a mediafolder in a different way?
Ended up finding a solution dont know if it is best practice but it works for now :
Not I good solution since calls to db happen in new scenario (see : http://issues.umbraco.org/issue/U4-1174)
so for now i will use rendermacro
follow up the problem here : http://issues.umbraco.org/issue/U4-1202
is working on a reply...