Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Can I get the displayname of a block programmatacally


How can I get the displayname of a block in code?

Apr 30, 2014 14:46

Hi, yes by casting the block to IContent

var content = myBlock as IContent;

if (content != null)
    var name = content.Name;


Apr 30, 2014 22:41

Or do you mean the type's displayname?

var repo = ServiceLocator.Current.GetInstance<BlockTypeRepository>();
var blockType = repo.Load<T>();
return blockType.DisplayName;


May 09, 2014 16:09
* 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.