umbraco - How to use Archetype with Razor? -


i can't believe couldn't find examples online.

this simple archetype. my archetype

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:

there other packages designed map archetype properties poco - e.g. https://our.umbraco.org/projects/developer-tools/archetype-mapper/


Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -