Been going over a few tutorials on Umbraco 10 and i have a few pages created as below (Home has a Home document type and all Child pages have Child Doc type)
Home
==Child 1
==Child 2
==Child 3
==Child 4
On the homepage i would like to display a list of Children with their page link and any additional properties i have.
I created a new controller inheriting from SurfaceController but this doesnt seem to work - my assumption is this Controller is only for Submitting forms?
I then decided to use UmbracoApiController but that looks to be useful for creating packages.
Could anyone help me get back on track with this please
That partially works but i cant get access to any of the properties i created.
It seems to be returning IPublishedContent like you rightly mentioned but how would i go about converting it to a Child Doc type?
I could do it the old way by looking for the property name (something like .GetProperty("name") but i was hoping for a strongly typed approach (I am using models builder).
Get Property value from page/Doc type
Hi guys
Been going over a few tutorials on Umbraco 10 and i have a few pages created as below (Home has a Home document type and all Child pages have Child Doc type)
On the homepage i would like to display a list of Children with their page link and any additional properties i have.
I created a new controller inheriting from SurfaceController but this doesnt seem to work - my assumption is this Controller is only for Submitting forms?
I then decided to use UmbracoApiController but that looks to be useful for creating packages.
Could anyone help me get back on track with this please
Hi Linx,
To get the cild pages on your homepage you can just do
Which returns an
IEnumarable<IPublishedContent>
Hi Huw
That partially works but i cant get access to any of the properties i created.
It seems to be returning IPublishedContent like you rightly mentioned but how would i go about converting it to a Child Doc type?
I could do it the old way by looking for the property name (something like .GetProperty("name") but i was hoping for a strongly typed approach (I am using models builder).
If you are using ModelsBuilder, you should be able to cast the results
is working on a reply...