November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
This is the original custom property (haven't changed much)
Edit:
I found a work-around which gets the job done, for now:
var tagsCategory = EPiServer.DataAbstraction.Category.Find("Tags");
var categoriesForCurrentPage = CurrentPage.Category;
var tagsForCurrentPage = new CategoryList();
foreach (int catId in categoriesForCurrentPage)
{
if (tagsCategory.FindChild(catId) != null) tagsForCurrentPage.Add(catId);
}
Now I've made a temporary work-around by doing the following
var tagsCategory = EPiServer.DataAbstraction.Category.Find("Tags");
var categoriesForCurrentPage = CurrentPage.Category;
var tagsForCurrentPage = new CategoryList();
foreach (int catId in categoriesForCurrentPage)
{
if (tagsCategory.FindChild(catId) != null) tagsForCurrentPage.Add(catId);
}
Which works fine for now.
[Pasting files is not allowed]
Having some trouble editing posts here...
I made a work-around which gets the job done:
var tagsCategory = EPiServer.DataAbstraction.Category.Find("Tags");
var categoriesForCurrentPage = CurrentPage.Category;
var tagsForCurrentPage = new CategoryList();
foreach (int catId in categoriesForCurrentPage)
{
if (tagsCategory.FindChild(catId) != null) tagsForCurrentPage.Add(catId);
}
That is the old way of doing custom properties.
Joel describe nearly the exact same custom prop here and how he solved it to be able to use it in a legacymode
http://joelabrahamsson.com/upgrading-a-site-from-episerver-cms-6-to-episerver-7/
I seems I still have some strange behavior going on. The custom property will work fine as long as I've edited the property and published the page. However, initially, before editing the custom property, the property will be NULL when accessed in the template. Eventually, I will probably either migrate to another tag plug-in or at least convert the legacy property to Dojo.
The following gets the job done until then
if (CurrentPage.Tags != null && CurrentPage.Tags.Count > 0)
{
DoSomethingWithTheData(CurrentPage.Tags.ToArray());
}
else
{
var tagsCategory = EPiServer.DataAbstraction.Category.Find("Tags");
var categoriesForCurrentPage = CurrentPage.Category;
var tagsForCurrentPage = new CategoryList();
foreach (int catId in categoriesForCurrentPage)
{
if (tagsCategory.FindChild(catId) != null) tagsForCurrentPage.Add(catId);
}
DoSomethingWithTheData(tagsForCurrentPage.ToArray());
}
Just an update:
After upgrading from 7.0 to 7.5 (7.13.3) I am no longer having this issue.
I'm having some issues with a custom page property which worked fine in v6, but not in v7. It seems like the values previously populated in the property is gone. On page load my custom property (CurrentPage.Tags) is always NULL. However, if a add a new value to the property, the property is no longer NULL - but only showing the new value(s), not values stored pre-v7.
Here's the basic layout of the custom property:
From the PageType class:
The custom property class:
The TagsControl class:
Any ideas to why this is happening?