简体   繁体   English

如何在razor中将css类属性添加到文本框?

[英]How do I add the css class attribute to a textbox in razor?

I have tried: 我试过了:

@Html.TextBoxFor(m => m.UserName, new {@class='textbox'})

which isn't working. 这是行不通的。

@Html.TextBoxFor(m => m.UserName, new {@class="textbox"})

A c# string literal does not take single quotes. c#字符串文字不带单引号。

'textbox' -> "textbox" 'textbox' - >“textbox”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM