我想我在这里遗漏了一些相对简单的东西,但我正在尝试找到一种将 CSS 类应用到我的 View 中的控件的方法。我正在使用
<%= Html.SubmitButton("Submit", "Edit Plot")%>
这样做的样式方法。如果不在这些元素周围放置 div 并应用样式,是否有任何方法可以访问 CssClass
在普通 .NET 中可用的属性?
最佳答案
查看 http://blog.veggerby.dk/2008/11/19/aspnet-mvc-htmlhelper-methods-and-css-class/ ,它只是:
<% = Html.TextBox("name", null, new{ @class = "required"}) %>
关于css - HTML.Controls 上的 ASP.NET MVC CSS 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/566363/