I've a got a clean umbraco install v7.2.4 and I've created a new media type of Slider Folder and Slider Items so in the media section I've created the folder (Node 1051) and some Slider Items underneath it.
And in razor (developer section - Partial View Macro Files) I'm trying to loop through the slider items and put some output onto my page but no matter what I attempt the page just gives me the error of Error loading Partial View script (file: ~/Views/MacroPartials/Show Slider Graphics.cshtml)
My script looks like this (obviously you can see how far I've got!)
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{var node = Model.GetNodeById(1051);}
This is my first real venture in MVC/Razor and I'm stumped at the first!
Get Media Items
Hi all,
I've a got a clean umbraco install v7.2.4 and I've created a new media type of Slider Folder and Slider Items so in the media section I've created the folder (Node 1051) and some Slider Items underneath it.
And in razor (developer section - Partial View Macro Files) I'm trying to loop through the slider items and put some output onto my page but no matter what I attempt the page just gives me the error of Error loading Partial View script (file: ~/Views/MacroPartials/Show Slider Graphics.cshtml)
My script looks like this (obviously you can see how far I've got!)
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@{var node = Model.GetNodeById(1051);}
This is my first real venture in MVC/Razor and I'm stumped at the first!
Any help would be marvellous.
Craig
You want Umbraco.TypedMedia(1051). From there, you can loop over the children.
To get more info on the error, modify your config/umbracoSettings.config file so you see macro errors:
You can also look for errors in App_Data/Logs/UmbracoTraceLog.txt.
You may friend are an international superstar!
That has driven me mental!
Hi Craig,
You can do it like this,
See the documentation here: https://our.umbraco.org/documentation/Reference/Querying/UmbracoHelper/
Hope this helps,
/Dennis
Cheers Dennis,
I'll have a butchers at that.
Thanks matey.
is working on a reply...