Heading of Block is set to its name at creation time.

Posted on

[ContentType(GUID = "93E02D00-1BA4-404E-9D04-BD6433E3AE6E")]
public class TechnicalDetailsBlock : SiteBlockData, ICreatingContentHandler
{
    public virtual String Heading { get; set; }

    public void CreatingContentHandler(object sender, ContentEventArgs e)
    {
// ReSharper disable SuspiciousTypeConversion.Global
        var technicalDetailsBlock = e.Content as TechnicalDetailsBlock;
// ReSharper restore SuspiciousTypeConversion.Global
        if (technicalDetailsBlock != null)
        {
            technicalDetailsBlock.Heading = e.Content.Name;
        }
    }
}

Explained doing strange casting

ICreatingContentHandler described

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s