Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc 2 如何将class属性添加到Html.Textbox或其他表单vallue_Asp.net Mvc 2_Attributes - Fatal编程技术网

Asp.net mvc 2 如何将class属性添加到Html.Textbox或其他表单vallue

Asp.net mvc 2 如何将class属性添加到Html.Textbox或其他表单vallue,asp.net-mvc-2,attributes,Asp.net Mvc 2,Attributes,如果我已经有一个ID属性,我如何添加class属性? 编译器一直对我大喊大叫 TextBox(“,”,新的{id=nodes[“id”].值类=???})) 需要@,可能是因为类在C中是一个保留字# 需要@,可能是因为类在C中是一个保留字35;如果在类中大写C,它将起作用 Html.TextBoxFor(m => m.Prop, new {Class="class"}) 正如Mystere所说,这是因为类是一个保留字 当您的aspx页面转换为html时,该属性将被小写,如果您在类中大写c

如果我已经有一个ID属性,我如何添加class属性? 编译器一直对我大喊大叫

TextBox(“,”,新的{id=nodes[“id”].值类=???}))

需要@,可能是因为类在C中是一个保留字#


需要@,可能是因为类在C中是一个保留字35;

如果在类中大写C,它将起作用

Html.TextBoxFor(m => m.Prop, new {Class="class"})
正如Mystere所说,这是因为类是一个保留字


当您的aspx页面转换为html时,该属性将被小写,如果您在类中大写c,它将起作用

Html.TextBoxFor(m => m.Prop, new {Class="class"})
正如Mystere所说,这是因为类是一个保留字

当您的aspx页面转换为html时,该属性将被小写