Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

IDynamicContentCustomPreview question

Vote:
 

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.

#52276
Jul 14, 2011 11:04
Vote:
 

You need to inherit IDynamicContent. Or if you inherit DynamicContentBase you'll get the interface for free

#55700
Dec 13, 2011 16:57
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.