What do you have at the top of your view?
Is the view being called via a custom route/controller? or from an Umbraco Surface Controller, or directly from an Umbraco view?
Honestly, I'm sure sure where in the documentation you would have found it. I'm pretty sure it's in there somewhere when it's talking about surface controllers but I'm not 100%.
I think I've picked it up from either the Umbraco Training Courses (I highly recommend them if you can), or other forum posts / discussions on Slack :-)
Umbraco.GetDictionaryValue in View
Hello all
How do I call @Umbraco.GetDictionaryValue in a view if my Model is custom?
i.e I don't have @inherits Umbraco.Web.Mvc.UmbracoTemplatePage at the top.
David
Hi David,
What do you have at the top of your view? Is the view being called via a custom route/controller? or from an Umbraco Surface Controller, or directly from an Umbraco view?
Thanks
Nik
Just @model List
I've tried adding using Umbraco.Core and Web but it doesn't like it.
Hi David,
If you remove @model and use
@inherits UmbracoViewPage<List>
(assuming List is the name of your type)You should get access to
@Umbraco
, and@Model
will be you model as you expect :-)Give that a go
Nik
Fantastic, that works. Just what I needed.
Where could I have found that out, is there a page in the documentation that would have told me?
Thanks again. David
Hi David,
Honestly, I'm sure sure where in the documentation you would have found it. I'm pretty sure it's in there somewhere when it's talking about surface controllers but I'm not 100%.
I think I've picked it up from either the Umbraco Training Courses (I highly recommend them if you can), or other forum posts / discussions on Slack :-)
Nik
is working on a reply...