A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More.
Create block type (class) and then create a view with the same name as your block. Example: MyBlock.cs and MyBlock.cshtml (under Views and Shared).
[ContentType()]
public class MyBlock : BlockData
{
}
Thanks for reply frederik.
here is the block i added
using System;
using System.ComponentModel.DataAnnotations;
using EPiServer.Core;
using EPiServer.DataAbstraction;
using EPiServer.DataAnnotations;
namespace Totalkredit.Models.Blocks
{
[ContentType(DisplayName = "FindBlock", GUID = "c3894d21-69fb-4cf3-b33f-75539ea5f8d4", Description = "")]
public class FindBlock : BlockData
{
[Display(
Name = "Find Block body",
Description = "",
GroupName = SystemTabNames.Content,
Order = 20)]
public virtual XhtmlString BlockBody { get; set; }
}
}
and FindBlock.cshtml look like following
@using EPiServer.Core
@using EPiServer.Web.Mvc.Html
@model Totalkredit.Models.Blocks.FindBlock
<div>
<div>some text and html</div><div>other divs</div>
@Html.PropertyFor(m => m.BlockBody)
</div>
when i add the block to page, i can't see the two div tags or the text?
I have html code containing some div tags. I want to create a block that contain that predefined html. so when i add the block to page it renders the html in the pages content area. what is simplist way to do that?