Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Class BlockData

Contains information about a specific block.

Inheritance
System.Object
BlockData
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Core
Assembly: EPiServer.dll
Version: 11.20.7
Syntax
[AvailableContentTypes(Availability = Availability.None)]
[AdministrationSettings(GroupName = "blocktypes", Visible = true, Order = 20)]
public class BlockData : ContentData, IContentData, IInitializableContent, IModifiedTrackable, IReadOnly<BlockData>, IReadOnly
Examples
      The following example shows how you can create a custom block data:
using EPiServer;
using EPiServer.Core;
using EPiServer.DataAnnotations;
using EPiServer.Framework.DataAnnotations;
using EPiServer.SpecializedProperties;
using EPiServer.Web;

[ContentType(DisplayName = "A page list", Description = "A block of properties needed to display a page list")]
public class PageList : BlockData
{
public virtual PageReference Root { get; set; }
public virtual int Count { get; set; }
public virtual string Heading { get; set; }
}

[ContentType]
public class MyPage : PageData
{
public virtual XhtmlString MainBody { get; set; }
public virtual PageList MainList { get; set; }
}

[TemplateDescriptor(Name = "My template", Description = "My first template", Path = "~/templates/MyTemplate.aspx", Default = true)]
public partial class MyTemplate : TemplatePage<MyPage>
{ }

[TemplateDescriptor(Name = "My block control", Description = "My first block control", Path = "~/templates/MyBlockControl.ascx", Default = true)]
public partial class MyBlockControl : BlockControlBase<PageList>
{ }

Constructors

BlockData()

Declaration
public BlockData()

Methods

CreateWritableClone()

Creates a writable clone of this object.

Declaration
public virtual BlockData CreateWritableClone()
Returns
Type Description
BlockData

A clone of this object.

Implements

Extension Methods

EPiServer.Core.IContentExtensions.GetPropertyName<TContent>(TContent, System.Linq.Expressions.Expression<System.Func<TContent, System.Object>>)