Dependency fields on properties in widget

Evine Beursken asked on January 4, 2017 09:59

I have created a widget called link in which I would like the option to select an icon (for example youtube icon, facebook icon).

In order to do so I have: A widget based on the web part Link/Button. I have added a new property called IconSelection (text, dropdownlist with options:

rss
facebook

In the standard property LinkText I would like to use this value. This icon is shown by using a span.

For example when selecting rss the html should look like this:

<a id="RSSFeedLink" href="/nl-nl/rssoverview/">
 <span class="ico rss"></span>
  RSS Feed
</a>

In order to achieve this I have added the following to the HTMLEnvelope before of the LinkText property: <span class="ico {%IconSelection.Value#%}"></span>

However, it does not work. Is it even possible to use the value of one property in another property? I did select 'has depending fields' for the IconSelection property and 'depends on another field' for the LinkText property.

Correct Answer

Roman Hutnyk answered on January 4, 2017 10:13

Have you added new property to code behind file and registered in Kentico? If this has been done I'd inject this property value into markup with regular asp syntax:

<span class="ico <%# IconSelection%>"></span>

I don't think Kentico resolves marco in web part layout...

1 votesVote for this answer Unmark Correct answer

Recent Answers


Evine Beursken answered on January 4, 2017 10:59

Thanks for the answer. I hoped it would be possible without creating a custom web part for it, that would make it easier but it will work with a custom web part!

0 votesVote for this answer Mark as a Correct answer

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