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="['Alabama','Alaska','Arizona','Arkansas','California']"
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.
var names = @Html.Raw(['Alabama','Alaska', 'Arizona', 'Arkansas', 'California']") $('.typeahead-StateName').typeahead( {source:names} );