我是ASP.NET MVC的初学者。我添加下拉菜单,但CSS无法正常工作。我该如何解决?这是我的代码:
@Html.DropDownListFor(m => Model.Fields[i], new SelectList(Model.attrs[i].atributeDetails, "AtributeDetailId", "AtDetailVal", int.Parse(Model.Fields[i])), " ", new { Class = "form-control", disabled = "disabled",style = "width:575px;height:25px;font-size:small;" })
答案 0 :(得分:2)
如果你说与'form-control'类相关的样式不起作用那么可能是因为'Class'字必须是小写的。我通常使用@class="my-class"
。所以也许尝试以下方法:
@Html.DropDownListFor(m => Model.Fields[i], new SelectList(Model.attrs[i].atributeDetails, "AtributeDetailId", "AtDetailVal", int.Parse(Model.Fields[i])), " ", new { @class = "form-control", disabled = "disabled",style = "width:575px;height:25px;font-size:small;" })