CategoryList property on IList<MyBlock> is not supported?

Vote:
 

This property on a BlockData type:

[Display(
	Name = "Predefined groups",
	GroupName = SystemTabNames.Content,
	Order = 20)]
public virtual CategoryList Groups { get; set; }

Causes errors when the block is used as an IList<MyBlock> property. 

[
    {
        "severity": 3,
        "errorMessage": "\u0022.2398(0).2470.\u0022 is not a valid value for \u0022Predefined groups\u0022."
    }
]

Is categorylist not supported? 

#330815
Oct 02, 2024 5:07
Vote:
 

Hi 

you need cast it to 

ICategorizable

see http://world.episerver.com/Blogs/Johan-Bjornfot/Dates1/2012/11/Shared-blocks--IContent/

something like this 

((EPiServer.Core.ICategorizable)CurrentBlock).Groups

which returns a CategoryList object.

Thanks,

Puneet

#330883
Edited, Oct 03, 2024 14:47
Vote:
 

Hi Arjan,

I don't think the CategoryList property type is supported on Blocks when using as an IList<>.

I created a sample project using Alloy with the categorylist added to the button block.

I then added a property to the start page with an IList<ButtonBlock>.

When I ran the code it threw up:

block type 'ButtonBlock' contains a Category property which is not supported for block list properties.

Hopefully that answers your question.

Thanks

Paul

#330890
Edited, Oct 03, 2024 16:39
Arjan Paauw - Oct 03, 2024 22:28
Right, that's a clear error message. Strange I didn't get that.
Thanks for your help!
* 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.