一、TextBoxFor说明
如: @Html.TextBoxFor(m => m.Title, new { @class = “mytext” })
生成的HTML代码是:
二、EditorFor说明
EditorFor写法同上TextBoxFor,如下:
@Html.EditorFor(m => m.Title, new { @class = “mytext” })
但EditorFor需要在model中定义对应的数据类别,默认为 Text,默认是与TextBoxFor相同
[DataType(DataType.Text)] //可以省略
public string Title { get; set; }
生成的HTML代码如下:
个人微信公众号,欢迎大家关注。