HiddenFor to display the encoded character

I have a string of elements passed to a hidden field for some jquery. Some elements in the string have an apostrophe '

in it, which the html helper converts to'

I've tried several options, but none works:

  • @Html.HiddenFor(model => model.qNotes)


    usual
  • @HttpUtility.HtmlDecode(Html.HiddenFor(model => model.qNotes))


    Displays it on the page instead of hidden
  • @Html.Hidden(HttpUtility.HtmlDecode(Model.qNotes).ToString())


    Still encodes it

Not sure how to go to this line if necessary to my predecessor.

+3


source to share





All Articles