Problem with inserting widget using editor

Hanh Dang asked on December 29, 2015 06:01

Hi all,

I tried to insert a widget using editor in kentico 9 website by following this link but no lucky. It returned the widget data without rendering like below one:

{^widget|(container)MySite.TwoStat|(leftstat)%3cp%3eIn+the+last+three+years%2c%3c%2fp%3e%0d%0a%0d%0a%3cp+class%3d%22number%22%3e%2b%3cspan%3e111%3c%2fspan%3e%3c%2fp%3e%0d%0a%0d%0a%3cp%3e%3cem%3eunderserved+students+have+increased+in+awards%3c%2fem%3e%3c%2fp%3e%0d%0a|(rightstat)%3cp%3eIn+the+last+three+years%2c%3c%2fp%3e%0d%0a%0d%0a%3cp+class%3d%22number%22%3e%2b%3cspan%3e222%3c%2fspan%3e%3c%2fp%3e%0d%0a%0d%0a%3cp%3e%3cem%3eunderserved+students+have+increased+in+awards%3c%2fem%3e%3c%2fp%3e%0d%0a|(displayas)row|(name)MySite.TwoStat|(widget_displayname)MySite+-+Two+stat|(width)|(height)^}

Does anyone know how to solve it?

Correct Answer

Juraj Ondrus answered on January 12, 2016 11:46

Thank you. I bit unclear where the two fields were added - to a page type or to the cloned web part properties? Then you are trying to use these two fields in the web part container? If yes, the dynamic controls are not resolved like this. This approach seems to be complicated.

I would rather change the layout of the web part instead of the container and add the code to the layout with these fields and call the resolve dynamic controls over these fields in the layout.

If you need to have the widgets inside the HTML editor regions, I would recommend to use more web parts, for example repeaters - one will be displayed before the web part and one after and use default transformations to resolve the data in the fields.

0 votesVote for this answer Unmark Correct answer

Recent Answers


Roman Hutnyk answered on December 29, 2015 14:30

Make sure "Disable macro" is not checked in editable text web part settings.

0 votesVote for this answer Mark as a Correct answer

Hanh Dang answered on December 30, 2015 02:59 (last edited on December 30, 2015 03:04)

Hi Roman,

The property "Disable macro" was not checked. I used macro to get data via its web part container. Is this the reason why the inline widget didn't work correctly?

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on January 4, 2016 12:35

What is the web part used for the editor? Please make sure the "Resolve dynamic controls" setting is set to true. If you are using ASPX templates, you may need to follow the idea from this article

0 votesVote for this answer Mark as a Correct answer

Hanh Dang answered on January 6, 2016 07:54

Hi Juraj,

It's a clone of Static text web part, "Resolve dynamic controls" was set to true and the template type is "HTML".

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on January 7, 2016 11:57

How was the clone made? Could you please describe this in more detailed steps so I can follow them and reproduce the issue on my end?

1 votesVote for this answer Mark as a Correct answer

Hanh Dang answered on January 11, 2016 09:20

1/ Create a clone of Static text web part

2/ Add new 2 fields RightContent(Data type: long text, Editor: CKEditor), LeftContent (Data type: long text, Editor: CKEditor)

3/ Create a web part container

<div class='container'>
    <div class='row'>
        <div class='col-sm-6'>
            {% RightContent %}
        </div>
        <div class='col-sm-6'>
            {% LeftContent %}
        </div>
        <!--Webpart-->
    </div>
</div>

Finally, I add a widget into Content property by using Editor

That's all.

0 votesVote for this answer Mark as a Correct answer

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