Cannot set htmlAttribute parameter
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
I think checked is a keyword. Try putting an @ in front:
new { @checked = true }
精彩评论