Hi, I'm trying to convert some old code from v7 to v8. Previously I used CurrentPage.DocumentTypeAlias == "SomeDocType" to compare document type alias in my page which is an UmbracoViewPage. However, when I try Model.DocumentTypeAlias it gives the error:
'IPublishedContent' does not contain a definition for 'DocumentTypeAlias' and no accessible extension method 'DocumentTypeAlias' accepting a first argument of type 'IPublishedContent' could be found (are you missing a using directive or an assembly reference?)
What is the proper way of finding a Model's DocumentTypeAlias?
DocumentTypeAlias In Umbraco 8
Hi, I'm trying to convert some old code from v7 to v8. Previously I used CurrentPage.DocumentTypeAlias == "SomeDocType" to compare document type alias in my page which is an UmbracoViewPage. However, when I try Model.DocumentTypeAlias it gives the error:
'IPublishedContent' does not contain a definition for 'DocumentTypeAlias' and no accessible extension method 'DocumentTypeAlias' accepting a first argument of type 'IPublishedContent' could be found (are you missing a using directive or an assembly reference?)
What is the proper way of finding a Model's DocumentTypeAlias?
Thanks!
Hi Frank
Have you tried...
Essentially IPublishedContent now has an 'IPublishedElement' describing it's ContentType.
There is additional a new extension method to check whether an IPublishedContent item is a certain type:
regards
marc
Thanks! Model.IsDocumentType worked perfectly!
is working on a reply...