Share via


HtmlHelper<TModel>.TextBoxFor<TResult> Method

Definition

Returns an <input> element of type "text" for the specified expression. Adds a "value" attribute to the element containing the first non-null value found in: the ModelState entry with full name, the expression evaluated against Model, or the htmlAttributes dictionary entry with key "value". See NameFor<TResult>(Expression<Func<TModel,TResult>>) for more information about a "full name".

public:
generic <typename TResult>
 virtual Microsoft::AspNetCore::Html::IHtmlContent ^ TextBoxFor(System::Linq::Expressions::Expression<Func<TModel, TResult> ^> ^ expression, System::String ^ format, System::Object ^ htmlAttributes);
public Microsoft.AspNetCore.Html.IHtmlContent TextBoxFor<TResult> (System.Linq.Expressions.Expression<Func<TModel,TResult>> expression, string format, object htmlAttributes);
abstract member TextBoxFor : System.Linq.Expressions.Expression<Func<'Model, 'Result>> * string * obj -> Microsoft.AspNetCore.Html.IHtmlContent
override this.TextBoxFor : System.Linq.Expressions.Expression<Func<'Model, 'Result>> * string * obj -> Microsoft.AspNetCore.Html.IHtmlContent
Public Function TextBoxFor(Of TResult) (expression As Expression(Of Func(Of TModel, TResult)), format As String, htmlAttributes As Object) As IHtmlContent

Type Parameters

TResult

The type of the expression result.

Parameters

expression
Expression<Func<TModel,TResult>>

An expression to be evaluated against the current model.

format
String

The format string (see https://msdn.microsoft.com/en-us/library/txafckwd.aspx) used to format the expression value when using that in the "value" attribute.

htmlAttributes
Object

An Object that contains the HTML attributes for the element. Alternatively, an IDictionary<TKey,TValue> instance containing the HTML attributes.

Returns

A new IHtmlContent containing the <input> element.

Implements

Applies to