London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
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