I've got the following ASP.NET 4 MVC 3 code in a view:

@Html.TextBoxFor(model => model.StateName, 
  new { data_provider = "typehead", data_items = "5", data_source = 
   "['Alabama','Alaska','Arizona','Arkansas','California']" })

The above is rendered on the page as:

<input data-items="5" data-provider="typehead" 
  data-source="[&#39;Alabama&#39;,&#39;Alaska&#39;,&#39;Arizona&#39;,&#39;Arkansas&#39;,&#39;California&#39;]" 
  id="StateName" name="StateName" type="text" value="" />

How do you display the data_source value unencoded? I'ved tried the @Html.Raw(content) as well as @MvcHtmlString.Create(content) with no luck.

link|improve this question

feedback

1 Answer

If you use JQuery with the following line:

$("#PersonName").data("source")

This returns:

['Alabama','Alaska','Arizona','Arkansas','California']

Is this what you want?

JSFiddle: http://jsfiddle.net/jEWF3/1/

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.