Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Chart: apostrophe ' is replaced with &#39 in chart's Title

When I display a chart and its title has an apostrophe, the title displays the ' as &#39.

How can I prevent this from happening?

like image 484
user776676 Avatar asked Jan 23 '26 14:01

user776676


1 Answers

<script>
    var data = [];
    var labels = [];
    @foreach (var item in Model) {     
        @:labels.push("@Html.Raw(HttpUtility.JavaScriptStringEncode(item.TitleWithApostrophe))");
    }    
</script>

More about this question here: Javascript, Razor and Escape characters. Like apostrophe

like image 186
zcarrington Avatar answered Jan 26 '26 02:01

zcarrington



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!