umbraco - How to use Archetype with Razor? -
i can't believe couldn't find examples online.
this tried:
<img src="@currentpage.ctatopleft.image" alt="@currentpage.ctatopleft.text"> but gives error:
'archetype.models.archetypemodel' not contain definition 'image'
edit: works:
<img src="@currentpage.getpropertyvalue("ctatopleft").fieldsets[0].getvalue("image")" alt="@currentpage.getpropertyvalue("ctatopleft").fieldsets[0].getvalue("text")"> wondering if there shorter way of writing it?
well, no - archetype property can have complex, nested set of data quite in collections may nested. in fact, it's quite common use corresponding nested set of partial views render out correctly if have example nested archetype properties (it happens).
there tutorials/samples available sort of thing:
- http://imulus.github.io/archetype/ - archetype home on github
- https://gist.github.com/kgiszewski/8863822 - 1 linked archetype page above - gives examples of usage razor/mvc.
there other packages designed map archetype properties poco - e.g. https://our.umbraco.org/projects/developer-tools/archetype-mapper/

Comments
Post a Comment