Adding HTML tags or break lines in the Content of a Link/Button Web part

Lambert Chan asked on July 12, 2019 02:08

I'm trying to have two lines of text on top of an uploaded image for a button. However the content field resolves everything into text and it doesn't accept html tags as tags but as strings. Is there a way to work around it so I can have 2 lines of information within the button?


Correct Answer

Brenden Kehren answered on July 13, 2019 03:02

The best way to handle this is with CSS or create your own form control.

1 votesVote for this answer Unmark Correct answer

Recent Answers

Roman Hutnyk answered on July 12, 2019 16:50

I think it works correctly: link is not an element to place paragraphs, spans or line break into it, so Kentico strips out all inappropriate tags.

There might be the way to implement what you need, but I wouldn't do that as it is not right.

I believe Previous <br/> shouldn't be a part of the link and has to be added within transformation, template, content before or something similar.

2 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on July 12, 2019 22:30 (last edited on July 13, 2019 03:25)

The link button is inherited from unibutton, which does HTML encode inside: lblText.Text = HTMLHelper.HTMLEncode(text) Search for UniButton.ascx inside Kentico project. So no matter what you put it will be encoded

0 votesVote for this answer Mark as a Correct answer

Lambert Chan answered on July 15, 2019 18:56

Thanks for the responses I just dealt with it (in a round about way) with CSS by placing an extra span and absolute positioning it into the right place. Not ideal but it works.

I would have liked to try your suggestion Peter but i don't have access to the Kentico project files itself so that unfortunately wasn't an option.

0 votesVote for this answer Mark as a Correct answer

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