daveaglick / FluentBootstrap

Provides extensions, helper classes, model binding, and other goodies to help you use the Bootstrap CSS framework from .NET code.
http://www.fluentbootstrap.com
MIT License
200 stars 76 forks source link

SetControlLabel no longer accepts raw HTML as parameter #58

Closed wardjc closed 7 years ago

wardjc commented 8 years ago

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 commented 8 years ago

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

daveaglick commented 8 years ago

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 commented 8 years ago

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

wardjc commented 7 years ago

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.

daveaglick commented 7 years ago

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.