Escaping single quote from an MVC 3 Razor View variable

前端 未结 3 2028
执笔经年
执笔经年 2021-01-18 11:50

I have a variable within item.Name that contains the string \"It\'s Tuesday!\". To alleviate javascript errors, in the c# controller I have already escaped this single quot

3条回答
  •  盖世英雄少女心
    2021-01-18 11:54

    The following can be used to prevent encoding of the output again. This does however rely on you properly dealing with it yourself.

    MVCHTMLString

    @MvcHtmlString.Create(yourString)
    

提交回复
热议问题