Custom webpart with three column with three editable text

Vadlamani . asked on September 19, 2020 10:52

Hello, I need to create a webpart having three column with editable text each.

Help me out how to achieve this.

Using portal engine kentico12 Thanks, Mithra

Correct Answer

Juraj Ondrus answered on September 21, 2020 14:44

So, you want to have something like default text loaded to the editable region? If yes, then I did this:

Created a custom web part inheriting from CMSAbstractWebPart class.
This is my ascx code (just snippets for inspiration):
<div> <h1 > <cms:CMSEditableRegion ID="TileTitle" runat="server" /> </h1> <p > <cms:CMSEditableRegion ID="TileDesc" runat="server" RegionType="HtmlEditor" /> </p> </div>

Amd in the code behind, you need to use the right event of the control life cycle to call the LoadContent method. I did it in the OnPreRender:

 protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);
        TileDesc.LoadContent("some content", true);
    }
0 votesVote for this answer Unmark Correct answer

Recent Answers


Brenden Kehren answered on September 19, 2020 14:53

Why now use what's there already? Add a webpart zone and wrap it in a div tag. Then add 3 editable text webparts to that web part zone web part and wrap each in a div tag with your dad class to make the 3 columns you need

0 votesVote for this answer Mark as a Correct answer

Vadlamani . answered on September 20, 2020 15:44

Thanks for you suggestion, but I require a custom webpart build and user can just drag and drop.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on September 21, 2020 06:34

You can drag&drop web parts in Kentico too. Anyway, if you want a custom web part, then build one and use the CMSEditableRegion control inside it - create the ASCX layout file and use the controls there as you wish. There is no magic - it is the same as any other custom control.

0 votesVote for this answer Mark as a Correct answer

Vadlamani . answered on September 21, 2020 13:35

Thank you. Is there a way I can assign a text value from webpart's properties?

0 votesVote for this answer Mark as a Correct answer

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