I have this input element which works fine with underscore templating.
<input id="color" name="color" value="<%= color %>" />
I want to use the Html.Helper
method to generate the element instead.
I initially tried just the basic helper
@Html.TextBox("color", "<%= color %>")
But that gives me
<input id="color" name="color" type="text" value="<%= color %>" />
I tried wrapping the value attribute with Html.Raw
but that gives the same result, and wrapping the entire helper results in the same thing.
The entire block is wrapped in a <script type="text/template">
tag.
Why is it converting <
to <
and how do I get it to stop?
This works, but is a little messy
@MvcHtmlString.Create(Html.TextBox("color", "<%= color %>").ToString().Replace("<", "<"))