.NET Framework Class Library InputExtensions..::.TextBoxFor<(Of <(TModel, TProperty>)>) Method (HtmlHelper<(Of <(TModel>)>), Expression<(Of <(Func<(Of <(TModel, TProperty>)>)>)>), Object) Returns a text input element for each property in the object that is represented by the specified expression, using the specified HTML attributes.
Namespace:
System.Web.Mvc.Html
Assembly:
System.Web.Mvc (in System.Web.Mvc.dll)

Syntax
<ExtensionAttribute> _
Public Shared Function TextBoxFor(Of TModel, TProperty) ( _
htmlHelper As HtmlHelper(Of TModel), _
expression As Expression(Of Func(Of TModel, TProperty)), _
htmlAttributes As Object _
) As MvcHtmlString
public static MvcHtmlString TextBoxFor<TModel, TProperty>(
this HtmlHelper<TModel> htmlHelper,
Expression<Func<TModel, TProperty>> expression,
Object htmlAttributes
)
[ExtensionAttribute]
public:
generic<typename TModel, typename TProperty>
static MvcHtmlString^ TextBoxFor(
HtmlHelper<TModel>^ htmlHelper,
Expression<Func<TModel, TProperty>^>^ expression,
Object^ htmlAttributes
)
Type Parameters- TModel
The type of the model.
- TProperty
The type of the value.
Return ValueType: System.Web.Mvc..::.MvcHtmlStringAn HTML input element whose type attribute is set to "text" for each property in the object that is represented by the expression.
Usage NoteIn Visual Basic and C#, you can call this method as an instance method on any object of type HtmlHelper<(Of <(TModel>)>). When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Exceptions
| Exception | Condition |
|---|
| ArgumentException | The expression parameter is nullNothingnullptra null reference (Nothing in Visual Basic) or empty. |

See Also
|
Biblioteca de clases de .NET Framework InputExtensions..::.TextBoxFor<(Of <(TModel, TProperty>)>) (Método) (HtmlHelper<(Of <(TModel>)>), Expression<(Of <(Func<(Of <(TModel, TProperty>)>)>)>), Object) Devuelve un elemento input de texto para cada propiedad del objeto representada por la expresión especificada, usando los atributos HTML especificados.
Espacio de nombres:
System.Web.Mvc.Html
Ensamblado:
System.Web.Mvc (en System.Web.Mvc.dll)

Sintaxis
<ExtensionAttribute> _
Public Shared Function TextBoxFor(Of TModel, TProperty) ( _
htmlHelper As HtmlHelper(Of TModel), _
expression As Expression(Of Func(Of TModel, TProperty)), _
htmlAttributes As Object _
) As MvcHtmlString
public static MvcHtmlString TextBoxFor<TModel, TProperty>(
this HtmlHelper<TModel> htmlHelper,
Expression<Func<TModel, TProperty>> expression,
Object htmlAttributes
)
[ExtensionAttribute]
public:
generic<typename TModel, typename TProperty>
static MvcHtmlString^ TextBoxFor(
HtmlHelper<TModel>^ htmlHelper,
Expression<Func<TModel, TProperty>^>^ expression,
Object^ htmlAttributes
)
Parámetros de tipo- TModel
Tipo del modelo.
- TProperty
Tipo del valor.
Parámetros- htmlHelper
- Tipo: System.Web.Mvc..::.HtmlHelper<(Of <(TModel>)>)
Instancia de la aplicación auxiliar HTML que este método extiende.
- expression
- Tipo: System.Linq.Expressions..::.Expression<(Of <(Func<(Of <(TModel, TProperty>)>)>)>)
Una expresión que identifica el objeto que contiene las propiedades que se van a presentar.
- htmlAttributes
- Tipo: System..::.Object
Un objeto que contiene los atributos HTML que se van a establecer para el elemento.
Valor devueltoTipo: System.Web.Mvc..::.MvcHtmlStringElemento input de HTML cuyo atributo type se establece en "text" para cada propiedad del objeto representado por la expresión.
Nota sobre el usoEn Visual Basic y C#, se puede llamar a este método como a un método de instancia en cualquier objeto de tipo HtmlHelper<(Of <(TModel>)>). Cuando emplee la sintaxis del método de instancia para llamar a este método, omita el primer parámetro. Para obtener más información, vea Métodos de extensión (Visual Basic) o Métodos de extensión (Guía de programación de C#).

Excepciones
| Excepción | Condición |
|---|
| ArgumentException | El parámetro expression es nullNothingnullptrreferencia null (Nothing en Visual Basic) o está vacío. |

Vea también
|