Skip to content
This repository has been archived by the owner on Jan 11, 2018. It is now read-only.

SetControlLabel no longer accepts raw HTML as parameter #58

Closed
wardjc opened this issue May 26, 2016 · 5 comments
Closed

SetControlLabel no longer accepts raw HTML as parameter #58

wardjc opened this issue May 26, 2016 · 5 comments
Labels

Comments

@wardjc
Copy link

wardjc commented May 26, 2016

If I use the below as the parameter for the function it is rendered on the page as below making it difficult to style the items in the label.

.SetControlLabel("SQL Server <span class='badge badge-primary'>Recommended</span>")

@wardjc
Copy link
Author

wardjc commented May 26, 2016

Appears to be New in version 3.3.5.3 of the core FluentBootstrap package.

@daveaglick
Copy link
Owner

That was a change in #53 and released in 3.3.5.3 to match up behavior of adding content to an element with what the native Razor controls do. I.e., it'll now automatically HTML escape plain strings. The simple way around this is to use new HtmlString():

.SetControlLabel(new HtmlString("SQL Server <span class='badge badge-primary'>Recommended</span>"))

@wardjc
Copy link
Author

wardjc commented Jun 2, 2016

Ah, fair enough mate. Cheers for taking the time.

@wardjc wardjc closed this as completed Jun 2, 2016
@wardjc
Copy link
Author

wardjc commented Nov 14, 2016

Hi Dave,

Not sure if you noticed but your above solution does not work for me. The string is still rendered as plain text (without the Bootstrap badge visible). That's with me adding .ToHtmlString() to the end of your solution above.

@wardjc wardjc reopened this Nov 14, 2016
@daveaglick daveaglick added the Bug label Nov 29, 2016
@daveaglick
Copy link
Owner

This is now resolved in the develop branch and will (hopefully) go out with a release later this week. You'll be able to use the new HtmlString() syntax above for SetControlLabel() as well as many other extensions.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants