先来看看2者的语法:
TextBoxFor():
MvcHtmlString Html.TextBoxFor(Expression<Func<TModel,TValue>> expression, object htmlAttributes)
TextBox():
MvcHtmlString Html.TextBox(string name, string value, object htmlAttributes)
下面Insus.NET举个列子来演示,先创建一个models:
Html.TextBox()例子: