Try our conversational search powered by Generative AI!

Finne alle sider basert på en sidetype

Vote:
 
Hvordan finne man alle sider som tilhører en bestemt sidetype? Jeg ønsker ikke å traverser alle sider fra rotsiden og nedover og så sjekke mot PageTypeId. Altså øsnker jeg en PageDataCollection med alle sider som er opprettet basert på en sidetype.
#11948
Apr 09, 2003 9:53
Vote:
 
Du kan använda PropertySearch, exempel: using EPiServer; using EPiServer.Core; using EPiServer.Filters; . . . int searchPageTypeID = 10; PropertyCriteriaCollection criterias = new PropertyCriteriaCollection(); PropertyCriteria criteria = new PropertyCriteria(); criteria.Name = "PageTypeID"; criteria.Type = PropertyDataType.PageType; criteria.Condition = CompareCondition.Equal; criteria.Value = searchPageTypeID.ToString(); criterias.Add(criteria); PageDataCollection pages = Global.EPDataFactory.FindPagesWithCriteria(Global.EPConfig.StartPage, criterias); foreach(PageData page in pages) { Response.Write(String.Format("
Found page: {0} - {1} ({2})", page.PageLink.ID, page.PageName, page.PageTypeName)); }
#13430
Apr 09, 2003 17:30
Vote:
 
thankyou thankyou! Just what I needed... even if it took time to find it... if I could add an improvement ... int DOCUMENT_TYPE_ID = int.Parse(EPiServer.Global.EPConfig["EPsDocumentTypeID"].ToString()); store the required pageID in the web.config.... as I found out when you have multiple copies of the same database (utv/testing/prod) it can be useful if some pages dont end up with the same page type ID! and for those searching for this in english some keywords to help you find it: PageType PropertyDataType.PageType
#13431
Apr 20, 2005 16:54
* 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.