Try our conversational search powered by Generative AI!

How to access the category property in a block?



We're having problems accessing the built in Category property in a block. If we get a default instance of a block and quickwatch it when debugging, we can see that the Category property is there, reached by ((Castle.Proxies.MyBlockProxy) (CurrentBlock)).Category. But how can we reach the categorylist by our CurrentBlock and be able to use its values? Or isn't this built in category property supposed to be used in a block?

Best regards,


Dec 06, 2012 14:34

you need cast it to 



Dec 06, 2012 14:39

And how easy it is when you know the answer. Thanks a lot :)

Dec 06, 2012 14:47

For those who are still confused, this is how I finally got it to work:


which returns a CategoryList object.

Edited, May 24, 2013 22:33

How do you set category programmatically cuz ((EPiServer.Core.ICategorizable)CurrentBlock).Category is just a get not set.

Feb 05, 2015 12:32

You can set the Category by casting your block as an ICategorizable object, and then adding the category ID.

((EPiServer.Core.ICategorizable)<block>).Category.Add(<category id>);

Aug 21, 2017 16:35
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.