AI OnAI Off
you need cast it to
see http://world.episerver.com/Blogs/Johan-Bjornfot/Dates1/2012/11/Shared-blocks--IContent/
For those who are still confused, this is how I finally got it to work:
((EPiServer.Core.ICategorizable)CurrentBlock).Category
which returns a CategoryList object.
How do you set category programmatically cuz ((EPiServer.Core.ICategorizable)CurrentBlock).Category is just a get not set.
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>);
Hi!
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,
Timea