有几个关于类似主题的问题。但是,它们实际上并没有解决我的问题。
ASP.NET MVC EditorFor DateTime
我一直在搜索和阅读,但找不到答案。
我目前正在使用它来格式化我的输入框:
@Html.TextBoxFor(modelItem => item.Quantity, new { style = "width: 30px;" })
从我的模型中,我得到了简短的数据注释:
[Required, Range(1, 100)]
public int Quantity { get; set; }
所以我明白了:
当我使用
@Html.EditorFor(modelItem => item.Quantity, new { style = "width: 30px;" })
我明白了:
我想要的是滚动,但要格式化宽度。
我想知道,有没有办法格式化EditorFor
with的宽度data annotations
?如果不是,那么制作这种格式的最简单方法是什么,以避免重复.. bootstrap
,css
?我对内联样式不满意。