I tried this
@Html.EditorFor(model => model.Name, " ", new { data_bind = "value:firstName" });
and other possible overloades but none of them seem to work.
The rest of code:
<script type="text/javascript">
$(document).ready(function () {
function AppViewModel() {
this.firstName = ko.observable("");
this.lastName = ko.observable("");
}
ko.applyBindings(new AppViewModel());
});
Your 3rd parameter to EditorFor
does not do what you think it should be doing.
See http://msdn.microsoft.com/en-us/library/ff406461(v=vs.98).aspx
EditorFor
cannot add HTML attributes to the element. Use TextBoxFor
instead:
@Html.TextBoxFor(model => model.Name, new { data_bind = "value:firstName" });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With