Implementing multiple editable text/images on a custom web part and loading/saving their contents

Fabio Goto asked on July 21, 2018 11:39

Hi! Another (really) noob question here:

I was trying to implement a custom web part with EditableImage and EditableText fields. Searching through the web, I found this article here: https://devnet.kentico.com/articles/custom-web-part-with-editable-regions---how-to-ensure-unique-ids-of-nested-editable-regions.

The article states it's for KenticoCMS 5, while I'm using 11. I tried registering and inserting one of each controls, like in the example but, while it does save the contents of each control, I can't apply any of the attributes (like DialogWidth or RegionType) like in the article.

Also, pressing enter on the EditableText makes the image selector dialog open.

From what I saw, both the WebParts for text and image implement the EditableText and EditableImage controls. Should I directly implement the controls on my custom web part, or can I keep using them like in the article?

Also, if I was to implement the controls on my web part, what's the best way to load the GetContent method to load the data on each control? From what I saw in webparts, the editabletext/editableimage each have their own GetContent for the control, like:

/// <summary>
/// Gets the current control content.
/// </summary>
public override string GetContent()
{
    if (!StopProcessing)
    {
        EnsureChildControls();

        return ucEditableImage.GetContent();
    }
    return null;
}

Thanks! :P

And sorry if I wrote it in a confusing way.

   Please, sign in to be able to submit a new answer.