Don't miss out Virtual Happy Hour this Friday (April 26).
Try our conversational search powered by Generative AI!
AI OnAI Off
Don't miss out Virtual Happy Hour this Friday (April 26).
You need to inherit IDynamicContent. Or if you inherit DynamicContentBase you'll get the interface for free
Hello,
I have a dynamic content user control MyControl.ascx:
[EPiServer.DynamicContent.DynamicContentPlugIn
(
DisplayName = "MyControl",
Description = "",
ViewUrl = "~/Templates/Common/DynamicContent/Plugins/"MyControl.ascx",
Url = "~/Templates/Common/DynamicContent/Plugins/"MyControl_SettingsControl.ascx"
)]
public partial class MyControl : EPiServer.UserControlBase
{
public EPiServer.Core.PropertyLongString MyProperty{ get; set; }
....
}
and a settings control MyControl_SettingsControl.ascx:
public partial class MyControl_SettingsControl : DynamicContentEditControl, IDynamicContentCustomPreview
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
txtMyProperty.Text = Content.Properties["MyProperty"].Value as string;
}
}
public override void PrepareForSave()
{
Content.Properties["MyProperty"].Value = txtMyProperty.Text;
}
public string CreateDirectPreview()
{
return "Some text I would like to see in TinyMCE";
}
public string CreateFullBlownPreview()
{
return null;
}
....
}
CreateDirectPreview does not seem to be being called.
Any pointers as to what am I doing wrong would be appreciated.
Regards,
Robert Gibbins.