London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
I'd like to access methods from a subBlock, as it was possible before with the CMS 6 without the blocks because we were using UserControls.
Here's some code to explain myself:
SubBlock.ascx.cs =>
----------------------------------------------------------------------------------------------
public partial class SubBlock: BlockControlBase<SubBlockBlock>
{
public string Method1() { return "A string"; }
}
----------------------------------------------------------------------------------------------
ParentBlock.ascx =>
----------------------------------------------------------------------------------------------
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ParentBlock.ascx.cs" Inherits="MyProject.Views.Blocks.ParentBlock" %>
<div>
<EPiServer:Property ID="SubBlock" runat="server" PropertyName="SubBlock" />
</div>
----------------------------------------------------------------------------------------------
ParentBlock.ascx.cs =>
----------------------------------------------------------------------------------------------
public partial class ParentBlock: BlockControlBase<ParentBlockBlock>
{
public string ParentMethod() { string aStringToDoSomething = SubBlock.Method1(); } //This of course doesn't work
}
----------------------------------------------------------------------------------------------
How can I do something like calling a method on a subBlock, any ideas?