I think these extension methods have been simplified in v8, so instead of having Umbraco.Field(), .GetProperty, GetPropertyValue, now there is an extension method .Value() on IPublishedContent, e.g.
var node = Umbraco.AssignedContentItem;
var myProperty1 = node.Value("myProperty");
var myProperty2 = node.Value<string>("myProperty");
var myProperty3 = node.Value<string>("myProperty", "en-US");
It depends on your property and which type you cast the property value to.
Rich text editor return IHtmlString, but if you are using ModelsBuilder the strongly typed models are already generated the properties using the correct types, at least for the core property editors or where a property value converter is available, otherwise the default type is of type object.
var site = Umbraco.AssignedContentItem.AncestorOrSelf(1);
var contactPage = site.FirstChild<Contact>();
var intro = contactPage.ContactIntro;
SurfaceController RenderMvcControllers documenation
Hi Daft question is there any documentation for surface and RenderMvcControllers for Umbraco 8.
I cannot seem to get getpropertyvalue anymore
Thanks George
Try
GetValue
instead if you're working from Services, otherwise forIPublishedContent
items, it's just.Value
.Hi George
I think these extension methods have been simplified in v8, so instead of having Umbraco.Field(), .GetProperty, GetPropertyValue, now there is an extension method
.Value()
onIPublishedContent
, e.g./Bjarne
Hi Bjarne
That seems right, but it seems you no longer need to add string etc as I added
The above flags up 'type argument specification is redundant'
Just need to figure out macros now :)
As macros now return the following text on the webpage: Umbraco.Web.Macros.MacroContent
George
It depends on your property and which type you cast the property value to.
Rich text editor return
IHtmlString
, but if you are using ModelsBuilder the strongly typed models are already generated the properties using the correct types, at least for the core property editors or where a property value converter is available, otherwise the default type is of typeobject
.Hi Bjarne
Thanks, this change to version 8 reminds me of when Microsoft went from classic asp to ASP.NET, big changes
George
is working on a reply...