开发者

Cannot set htmlAttribute parameter

开发者 https://www.devze.com 2023-02-11 07:54 出处:网络
I\'m adding in the 开发者_运维知识库object htmlAttributes parameter and getting an error : \"Error41Invalid anonymous type

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

精彩评论

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