Category bug in shared block?

Ruwen Jin
Member since: 1997

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?

#63932 Dec 05, 2012 10:19
  • Ruwen Jin
    Member since: 1997


    #63986 Dec 06, 2012 12:08
  • Linus Ekström
    Member since: 2002

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

    #63987 Dec 06, 2012 12:30
  • Ruwen Jin
    Member since: 1997
                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.


    #63992 Edited, Dec 06, 2012 13:08
  • Linus Ekström
    Member since: 2002

    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.

    #65394 Jan 29, 2013 8:48
  • Ruwen Jin
    Member since: 1997

    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.

    #65411 Jan 29, 2013 13:40
  • Ger Groot
    Member since: 2011

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

    #66237 Feb 25, 2013 14:02
  • Linus Ekström
    Member since: 2002

    I have created the following bug to investigate this:

    Bug #96172: Categories that are empty does not clear their value
    #66239 Feb 25, 2013 14:29
  • Xudonax
    Member since: 2014

    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]

    #82347 Mar 11, 2014 10:40