NodeById, MediaById giving errors when used in umbraco templates
HI All,
I'm new to Umbraco 7.
I'm trying to get descendants based on content picker property. When I tried to use NodeById and MediaById i'm getting the following error.
Compiler Error Message: CS1061: 'Umbraco.Web.Models.RenderModel' does not contain a definition for 'MediaById' and no extension method 'MediaById' accepting a first argument of type 'Umbraco.Web.Models.RenderModel' could be found (are you missing a using directive or an assembly reference?)
I managed Umbraco.Content(CurrentPage.contentpickerproperty).children in place of NodeById, but I need to get Media image Url based on Id.
NodeById, MediaById giving errors when used in umbraco templates
HI All,
I'm new to Umbraco 7.
I'm trying to get descendants based on content picker property. When I tried to use NodeById and MediaById i'm getting the following error.
Compiler Error Message: CS1061: 'Umbraco.Web.Models.RenderModel' does not contain a definition for 'MediaById' and no extension method 'MediaById' accepting a first argument of type 'Umbraco.Web.Models.RenderModel' could be found (are you missing a using directive or an assembly reference?)
I managed Umbraco.Content(CurrentPage.contentpickerproperty).children in place of NodeById, but I need to get Media image Url based on Id.
I'm using the following name spaces in template
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage @using umbraco; @using umbraco.MacroEngines; @using umbraco.macroRenderings; @using System.Web.Razor;
Any suggestions please
Regards, Phani
Since u are using the UmbracoTemplatePage u can do 2 things
If you are using an Upload property you can just use
and if you are using a media picker you can go at it like this
Hope this helps.
Casper
Hi Casper,
Thanks a ton.
It worked like a charm :)
Regards. Phani
Your welcome.
Would you mind marking my answer as the solution so people who have the same problem in the future can easily find the solution
HI Casper,
I did it :)
is working on a reply...