November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi Tobias,
I had to do something similar recently myself and i found the following article very helpful: http://www.epinova.no/blog/Kjetil-Simensen/dates/2010/4/extended-pagetree/
The method "CreateItemRecursive" is used to process each page and it is here you can filter the pages to display. The method uses a comma-separated string property to to filter out pagetypes but you can moify this "CreateItemRecursive" method to check the page[your_checkbox_propertyname] property instead. For your pages you could create a bool property called "IncludeInSiteMap" and filter as follows...
e.g.) Change the following:
foreach (string s in pagetypenames)
{
if (s.Equals(page.PageTypeName, StringComparison.CurrentCultureIgnoreCase))
{
dontInclude = true;
break;
}
}
if(dontInclude) continue;
...to...
if (page["IncludeInSitemap"] == null) // or some similar check
{
dontInclude = true;
break;
}
if(dontInclude) continue;
Hope that helps
Add an event handler to the Filter event of the PageTree,
<EPiServer:PageTree runat="server" Filter="FilterVisibleInMenu" ...
In codebehind:
protected void FilterVisibleInMenu(object sender, EPiServer.Filters.FilterEventArgs e)
{
for(int i = e.Pages.Count - 1; i--; i >= 0)
{
if (!e.Pages[i].VisibleInMenu && (e.Pages[i]["IncludeInSiteMap"] == null))
{
e.Pages.RemoveAt(i);
}
}
}
Or something like that (freehand code, could have logic and/or synax errors).
Does anyone have a simple solution to let the editor set that a page that is not VisibleInMenu to be shown in the sitemap when using a EPiServer:PageTree with EnableVisibleInMenu set to true. Not all "invisible" pages shnould be shown, only those that the editor sets (with a checkbox property on the page).
Is it possible when using this setup or do we have to iterate through the pages and use a standard asp:treeview?