I’m attempting to data-bind a value to an ASP.NET DropDownList but the server complains that it doesn’t recognize the data-bind attribute:
<%=Html.DropDownList("accountSiteInstanceId", ViewData["degreePrograms"] as SelectList, new { @data-bind = "value: DegreeProgramId" } ) %>
I get the following error:
Compiler Error Message: CS0746: Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access.
The problem is the dash. Use dictionary based notation: