Try our conversational search powered by Generative AI!

Category bug in shared block?


We created a shared block and used in a contentarea. Shared block has a category property and other properties. We update the category property with value it works in preview and in content area. When we upate the category property without any value ( remove all categories ) it works in preview but in contentarea it remains to previous value. Is it a bug? Is there any workaround for it?

Dec 05, 2012 10:19


Dec 06, 2012 12:08

How do you see that it's wrong? Are you rendering the categories in the block template?

Dec 06, 2012 12:30
            Name = "Huvudnod för expertområde",
            Description = "Välj den nod som utgör rooten för önskat expertområde.",
            GroupName = SystemTabNames.Content,
            Order = 180)]
        public virtual CategoryList AreaOfExpertiseRoot { get; set; }

   and in cshtml

@Html.DropDownList("areaofexpertise", Model.getExpertiseArea())   

function getExpertisArea

public List<SelectListItem> getExpertiseArea() { if (AreaOfExpertiseRoot == null) { throw new ApplicationException("En huvudkategori för Expertområde är inte tilldelad. Det går inte att hämta expertområden."); } Category category = Category.Find(AreaOfExpertiseRoot.First()); var t = base.Property["DefaultAreaOfExpertis"]; var defaultExpertise = DefaultAreaOfExpertise != null ? DefaultAreaOfExpertise.First() : -1; List<SelectListItem> selectListItems = new List<SelectListItem> { new SelectListItem { Value = "!", Text = AreaSelectorName, Selected = defaultExpertise == -1 ? true : false } }; List<Contact> contacts = getContactList(); if (category != null) { try { selectListItems.AddRange(from Category areaOfExpertise in category.Categories where contacts.Any(contact => contact.AreaOfExpertise.Contains(areaOfExpertise.ID)) select new SelectListItem { Value = areaOfExpertise.Name.Replace(" ", string.Empty), Text = areaOfExpertise.Name, Selected = ((defaultExpertise != -1) && (areaOfExpertise.ID == defaultExpertise)) ? true : false }); } catch (Exception e) { //send error to logfile , redirect to errorpage! } } return selectListItems; }
    The problem is that DefaultAreaOfExpertis never be null once we have value in it. When we set it to empty in contentarea it always remain last inserted value. Change value works though.


Edited, Dec 06, 2012 13:08

Are you doing programatical updates to the property. If so, this is a known bug that will be fixed in an update soon to be released.

Jan 29, 2013 8:48

thanks. But we are changing category with normal edit-ui. It works on the block/page but changes does'nt show in page that using block.

Jan 29, 2013 13:40

I'm having the same problem. The previous value is still available despite the fact that the field in Edit mode is empty.

Feb 25, 2013 14:02

I have created the following bug to investigate this:

Bug #96172: Categories that are empty does not clear their value
Feb 25, 2013 14:29

What we discovered is that this can happen when you already assigned a non-CultureSpecific category to something, and then change the master language. Once you do this, EPiServer will still see and display the cateogries that are not in your master language, but you cannot edit or delete them from the CMS.

To get rid of those categories, you have to manually go into the database you configured and remove the items from [dbo].[tblContentCategory]

Mar 11, 2014 10:40
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.