如何在Html.TextBox帮助器中设置css类?

时间:2021-04-16 19:39:02

Is it possible to set a css class in a TextBox html helper? This doesn't compile, obviously:

是否可以在TextBox html帮助器中设置css类?这显然不能编译:

<%=Html.TextBox("Region",Model.Region,new {class="Autocomplete"}) %>

Thanks.

谢谢。

1 个解决方案

#1


23  

Class is a reserved keyword, so you need to write it like this:

Class是保留关键字,因此您需要像这样编写它:

<%=Html.TextBox("Region", Model.Region, new { @class="Autocomplete" }) %>

#1


23  

Class is a reserved keyword, so you need to write it like this:

Class是保留关键字,因此您需要像这样编写它:

<%=Html.TextBox("Region", Model.Region, new { @class="Autocomplete" }) %>