SaaS CMS has officially launched! Learn more now.

Check if pagetype by using contenttypes guid?


How can I do a check to see if a page (pagedata) are is a pagetype with the by comparing the guid?

I know what guid the pagetype has, but how can I check that field by code if I have a PageData reference?

Feb 06, 2014 14:16

var contentRepository = ServiceLocation.ServiceLocator.Current.GetInstance<IContentRepository>();

var page = contentRepository.Get(someReference);

IContentTypeRepository contentTypeRepository = Locate.ContentTypeRepository();

var contentType = contentTypeRepository.Load(page.ContentTypeID);

var guid = contentType.Guid;

Edited, Feb 06, 2014 14:30

Thanks a moderload!

Feb 06, 2014 15:45
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.