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-bindto@data_bindand this will then render with a hyphen on the page.