Reputation: 1499
I'm adding in the object htmlAttributes parameter and getting an error :
"Error 41 Invalid anonymous type member declarator. Anonymous type members must be declared with a member assignment, simple name or member access"
Response.Write(Html.CheckBox("chkStatus", item.Value) + " " + item.Text + "<br />");
Response.Write(Html.CheckBox("chkStatus", item.Value,new {checked=true}) + " " + item.Text + "<br />");
I get the error when i try to add the "new {checked=true} part.
Cannot find an example of setting parameter in c# code online, cheers
Upvotes: 0
Views: 379
Reputation: 46008
I think checked is a keyword. Try putting an @ in front:
new { @checked = true }
Upvotes: 2