I am using ASP.NET MVC 3.0 and KnockoutJS
. I was trying to add the binding into my View Helpers like this ...
@Html.TextBoxFor(model => model.Name, new { @placeholder = "Name", @size = "35", @data-bind = "value: aName" })
But this throws the exception ...
Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access.
Can anyone enlighten me on what this means - and moreover, how to solve it?
It doesn't like the hyphen in the property name. To fix this change @data-bind
to @data_bind
and this will then render with a hyphen on the page.
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