4

I have created a composite control in Sitecore 9 and I can use that in template editor when adding new fields.

enter image description here

This control is supposed to show an Image control where I can browse and select images but I can't see any browse button.

enter image description here

Out of the box image control shows these options

enter image description here

my code

public class CustomImage : Sitecore.Web.UI.HtmlControls.Control
{
    public CustomImage()
    {
        this.Class = "scContentControl";
        base.Activation = true;
    }
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        if (!Sitecore.Context.ClientPage.IsEvent)
        {
            var image = new Sitecore.Shell.Applications.ContentEditor.Image();
            this.Controls.Add(image);

        }
        else
        {
        }
    }
}

I could not find any example on how to add image control in composite control, so code is very basic.

Once I get this working, my goal is to have 4 image controls in one composite control.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.