Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
First up, I found a solution. Do this:
I have an MNTP which picks to a CSV. I can pick a few items, and it usually works. I'm pulling it out with @Model.propertyName
1 item works fine. 1234 is the result, and also in the umbraco.config
2 items DOES NOT work fine. 12345678 is the result, but the config has 1234,5678 in it.
3 or more items DOES WORK. 1234,5678,9012 etc etc.
The solution above fixes it. Any ideas why?
I'm using 4.7.1 with uC 3, but it was happening with uC 2, and I doubt uC is the problem.
Without digging into the Umbraco core, I'm not 100% sure what the Razor engine does with MNTP values - but I do know that there is a specific check for MNTP and some manipulation happens.
An alternative could be to look at the Razor DataType Models project? - it's not a "proper" package yet, although if you pull down the source there is an MSBuild script in the "_build" directory that will generate the package for you.
This is a known issue, see my comment to this issue (bottom of the page). It's been fixed for 126.96.36.199.
Instead of @Model.GetProperty("name").Value, try using @Model.GetPropertyValue("name") everywhere (new in 4.7.1), it's a bit nicer and I believe it does null checking for you, so if the property is empty, you get an empty string back.
Thanks Lee and Sebastiaan. I've got the dev to swich over to using .GetPropertyValue :)
The RazorDataTypes thing sounds good, but we dont use them that much - and we have worker methods already, which take (for eg) a CSV list of node ids, and return a lit of products (from our product database), doing all the load-a-node-and-lookup-a-field nonsense behind the scenes.
Cheers guys. Pity I can't mark both as "great answers" (or can I?)
You can "High five" Lee's question! :-)
I did :) and yours. Except, it's not saving them :(
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted