开发者

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 }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜