@inherits UmbracoTemplatePage<IPublishedContent>'
@{
var documentTypeAlias = CurrentPage.DocumentTypeAlias; <!-- This is the documenttype alias, it is needed to be able to fetch the contenttype with the ContentTypeService on the next line.
var documentType = ApplicationContext.Current.Services.ContentTypeService.GetContentType(documentTypeAlias); <!-- Fetch the documenttype with the alias.
}
<p>@documentType.Name</p> <!-- This is the name of the documenttype, in your case 'Leiter'
<p>@documentType.Alias</p> <!-- This is the alias of the documenttype, in your case 'Leader'
DocumentType Name but not DocumentTypeAlias
Hi together
I'm trying to get the Document Type Name from my IPublishedContent Object in a Partial View.
I tried this:
With this i got the Alias of the Document Type, but i want the Name. I already tried things like this
But this doesn't work.
Can anyone help me?
Greets, Silvan
I searched for about some hours now and didn't find anything.
I do this
So then i have the templateId. But now how can i get the template Name?
I tried this, but this doesnt work:
Any other suggestions?
Hi Silvan!
Here is how you can get the DocuemtType Name.
Let me know if this helps you!!
All the best! / Dennis
Thats only the DocumentType Alias!
I need the DocumentType Name
With your solution i get "Leader" but I need the "Leiter" Value.
Did you try this?
Oops, Sorry.
I only tried to show @documentType and didn't add @documentType.Name.
Your solution now worked! Thank you very much! :D
I spent too much time for this....
That sounds great Silvan! Glad that it worked out for you!! I can understand that you got frustrated after spending too much time with this.
Best of luck to you with the rest of the site!! Have a great day!
/Dennis
is working on a reply...