Closed Ready4Next closed 8 years ago
It was changed via #53 due to concerns over security. Specifically, FluentBootstrap was using different escaping rules than Razor does with the @
syntax. I agreed with the PR that it makes sense to escape by default, and then allow the developer to opt-out of escaping (rather than the other way around).
Just put your raw HTML inside a new HtmlString
and you should be good to go:
@Html.Bootstrap().Button(new HtmlString("<span class=\"fa fa-3x fa-clock-o\"></span>"), ButtonType.Button)
Thanks for the complete answer Dave,
I already have tried that solution, but I get an error saying
Cannot convert from 'System.Web.HtmlString' to 'string'
There is no overload for Button to take a IHtmlString instead of a string. So even Html.Raw() does not work. Do you plan to add one or maybe there is another solution ?
I have just checked #53, and I see that AddContent serve precisely what I intented to do, so instead of
@Html.Bootstrap().Button(new HtmlString("<span class=\"fa fa-3x fa-clock-o\"></span>"), ButtonType.Button)
I have done that this way:
Html.Bootstrap().Button("", ButtonType.Button).AddContent(Html.Raw("<span class=\"fa fa-3x fa-clock-o"))
And it does the trick :), maybe adding an overload in the future would be clearer :)
Thanks for this great lib :)
Perfect! Glad you got it worked out.
Hi,
When making a
@Html.Bootstrap().Button("<span class=\"fa fa-3x fa-clock-o\"></span>", ButtonType.Button)
Now renders as `
` It used to work in earlier versions... Is there any good reason to have changed that ? Thanks :)