先来看看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:
![](https://images2015.cnblogs.com/blog/28036/201603/28036-20160323140233667-2109566626.png)
Html.TextBoxFor()例子:
![](https://images2015.cnblogs.com/blog/28036/201603/28036-20160323142147401-2062834662.png)
Html.TextBox()例子:
![](https://images2015.cnblogs.com/blog/28036/201603/28036-20160323142331276-44599271.png)
它们有什么区别:
![](https://images2015.cnblogs.com/blog/28036/201603/28036-20160323143644214-2085228734.png)