Is there a nice way to render a block name? I've tried most combinations like:
<%= CurrentBlock["Name"] %>
<%= CurrentBlock["BlockName"] %>
<%= CurrentBlock["ContentName"] %>
The only way that seems to work is:
<%= CurrentBlock.Property %>
maybe not so nice, but you could do this:
Well, better than my approach. Thanks,
Shouldn't Name be a property on BlockData?
The reason Name is not a property on BlockData is that Name is part of interface IContent. Blocks are a special building block which can both be used as properties on pages (often referred to as local blocks) in that case the block will not implement IContent. However blocks can also be created as own entititys (often referred to as shared blocks), in that case at runtime a subclass to the block type is created, this new subclass will implement IContent (and hence a shared block instance have a Name while a local block doesn't). More info is here http://world.episerver.com/Blogs/Johan-Bjornfot/Dates1/2012/11/Shared-blocks--IContent/
Thanks for the update Johan. Makes sense!