I'm having to use JArray to get RelatedLinks as RelatedLinks isn't in Umbraco.Web.Models
And the following won't work to get data out of a Dropdown List Multiple (this is example code from the docs)
@{
if (Model.Content.HasValue("superHeros")){
<ul>
@foreach(var item in Model.Content.GetPropertyValue<string>("superHeros").Split(',')) {
<li>@item</li>
}
</ul>
}
}
If I ask if(Model.Content.HasProperty("superHeros")) it succeeds. If I ask if(Model.Content.HasValue("superHeros")) it quietly fails as if it has no value, which I know it does!
As of the latest build, it's not "using" either. Umbraco.Core.Models (says it's already in use) or Umbraco.Web.Models (says it's not required).
If I try to type in var newitem = block.GetPropertyValue<Umbraco.Web.Models.>("myLinks") RelatedLinks isn't offered after Models.It's as if web.config or the dll's are the wrong version maybe. It's a very hacked about site and other devs have a habit of keeping their own web.config files so I can imagine it's something like that. Unless there's a more obvious answer I can't see. Wish I could build the thing again from scratch, but not allowed :(
The dropdown list multiples are being stored in Nested Content. I just came across this: https://github.com/umco/umbraco-nested-content saying there's an issue with them, checkbox lists and radio button lists. Looks like I'm going to have to re-engineer this solution again.
Missing something basic
Umb 7.5.11, legacy site, ModelsBuilder Off.
I can't work out what's missing if, in a partial with all these usings (which are actually being used):-
I'm having to use JArray to get RelatedLinks as RelatedLinks isn't in Umbraco.Web.Models
And the following won't work to get data out of a Dropdown List Multiple (this is example code from the docs)
If I ask if(Model.Content.HasProperty("superHeros")) it succeeds. If I ask if(Model.Content.HasValue("superHeros")) it quietly fails as if it has no value, which I know it does!
Any advice would be appreciated.
-Craig
Hi
I know its probably not this - but just to confirm your usings have
Umbraco.Core.Models
, and notUmbraco.Web.Models
too. - is that right ?Kevin
As of the latest build, it's not "using" either.
Umbraco.Core.Models
(says it's already in use) orUmbraco.Web.Models
(says it's not required).If I try to type in
var newitem = block.GetPropertyValue<Umbraco.Web.Models.>("myLinks")
RelatedLinks isn't offered afterModels.
It's as if web.config or the dll's are the wrong version maybe. It's a very hacked about site and other devs have a habit of keeping their own web.config files so I can imagine it's something like that. Unless there's a more obvious answer I can't see. Wish I could build the thing again from scratch, but not allowed :(The dropdown list multiples are being stored in Nested Content. I just came across this: https://github.com/umco/umbraco-nested-content saying there's an issue with them, checkbox lists and radio button lists. Looks like I'm going to have to re-engineer this solution again.
is working on a reply...