Try our conversational search powered by Generative AI!

Render block name



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[0] %>


Nov 06, 2013 23:00

maybe not so nice, but you could do this:



Nov 07, 2013 7:45

Well, better than my approach. Thanks,

Shouldn't Name be a property on BlockData?

Nov 07, 2013 22:29

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

Nov 08, 2013 11:48

Thanks for the update Johan. Makes sense!

Nov 08, 2013 18:50
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.