Reputation: 2165
I have a TextBoxFor like this:
@Html.TextBoxFor(x => x.Test, new { data_binding = "value:Test,events:['keyup']" })
The output is:
<input data-binding="value:Test,events:['keyup']" id="Test" name="Test" placeholder="" type="text" />
The ' around keyup are replaced with &# 39; .
How do I prevent escaping/sanitazing of the attribute value?
Upvotes: 0
Views: 217
Reputation: 22619
I think you just had a look of generated view source of the page. View Source will add the unicode chars for '
and "
No need to worry. check how it is rendered in DOM using Firebug.
If you want to access that data value in javascript, you can try like below
@Html.TextBoxFor(x => x.Name,
new { data_binding = "value:Test,events:['keyup']", @id="test" })
<script type="text/javascript">
$(document).ready(function () {
alert($('#test').data('binding'));
});
</script>
Upvotes: 1