HtmlHelperInputExtensions.TextBox HtmlHelperInputExtensions.TextBox HtmlHelperInputExtensions.TextBox Method

Definition

Overloads

TextBox(IHtmlHelper, String) TextBox(IHtmlHelper, String) TextBox(IHtmlHelper, String)

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 ViewData entry with full name, or the expression evaluated against Model. See Name(String) for more information about a "full name".

TextBox(IHtmlHelper, String, Object) TextBox(IHtmlHelper, String, Object) TextBox(IHtmlHelper, String, Object)

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 value parameter, the ViewData entry with full name, or the expression evaluated against Model. See Name(String) for more information about a "full name".

TextBox(IHtmlHelper, String, Object, Object) TextBox(IHtmlHelper, String, Object, Object) TextBox(IHtmlHelper, String, Object, Object)

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 value parameter, the ViewData entry with full name, the expression evaluated against Model, or the htmlAttributes dictionary entry with key "value". See Name(String) for more information about a "full name".

TextBox(IHtmlHelper, String, Object, String) TextBox(IHtmlHelper, String, Object, String) TextBox(IHtmlHelper, String, Object, String)

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 value parameter, the ViewData entry with full name, or the expression evaluated against Model. See Name(String) for more information about a "full name".

TextBox(IHtmlHelper, String) TextBox(IHtmlHelper, String) TextBox(IHtmlHelper, String)

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 ViewData entry with full name, or the expression evaluated against Model. See Name(String) for more information about a "full name".

public static Microsoft.AspNetCore.Html.IHtmlContent TextBox (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper, string expression);
static member TextBox : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper * string -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function TextBox (htmlHelper As IHtmlHelper, expression As String) As IHtmlContent

Parameters

htmlHelper
IHtmlHelper IHtmlHelper IHtmlHelper

The IHtmlHelper instance this method extends.

expression
String String String

Expression name, relative to the current model.

Returns

A new IHtmlContent containing the <input> element.

Remarks

Combines HtmlFieldPrefix and expression to set <input> element's "name" attribute. Sanitizes expression to set element's "id" attribute.

TextBox(IHtmlHelper, String, Object) TextBox(IHtmlHelper, String, Object) TextBox(IHtmlHelper, String, Object)

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 value parameter, the ViewData entry with full name, or the expression evaluated against Model. See Name(String) for more information about a "full name".

public static Microsoft.AspNetCore.Html.IHtmlContent TextBox (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper, string expression, object value);
static member TextBox : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper * string * obj -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function TextBox (htmlHelper As IHtmlHelper, expression As String, value As Object) As IHtmlContent

Parameters

htmlHelper
IHtmlHelper IHtmlHelper IHtmlHelper

The IHtmlHelper instance this method extends.

expression
String String String

Expression name, relative to the current model.

value
Object Object Object

If non-null, value to include in the element.

Returns

A new IHtmlContent containing the <input> element.

Remarks

Combines HtmlFieldPrefix and expression to set <input> element's "name" attribute. Sanitizes expression to set element's "id" attribute.

TextBox(IHtmlHelper, String, Object, Object) TextBox(IHtmlHelper, String, Object, Object) TextBox(IHtmlHelper, String, Object, Object)

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 value parameter, the ViewData entry with full name, the expression evaluated against Model, or the htmlAttributes dictionary entry with key "value". See Name(String) for more information about a "full name".

public static Microsoft.AspNetCore.Html.IHtmlContent TextBox (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper, string expression, object value, object htmlAttributes);
static member TextBox : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper * string * obj * obj -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function TextBox (htmlHelper As IHtmlHelper, expression As String, value As Object, htmlAttributes As Object) As IHtmlContent

Parameters

htmlHelper
IHtmlHelper IHtmlHelper IHtmlHelper

The IHtmlHelper instance this method extends.

expression
String String String

Expression name, relative to the current model.

value
Object Object Object

If non-null, value to include in the element.

htmlAttributes
Object Object 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.

Remarks

Combines HtmlFieldPrefix and expression to set <input> element's "name" attribute. Sanitizes expression to set element's "id" attribute.

TextBox(IHtmlHelper, String, Object, String) TextBox(IHtmlHelper, String, Object, String) TextBox(IHtmlHelper, String, Object, String)

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 value parameter, the ViewData entry with full name, or the expression evaluated against Model. See Name(String) for more information about a "full name".

public static Microsoft.AspNetCore.Html.IHtmlContent TextBox (this Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper htmlHelper, string expression, object value, string format);
static member TextBox : Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper * string * obj * string -> Microsoft.AspNetCore.Html.IHtmlContent
<Extension()>
Public Function TextBox (htmlHelper As IHtmlHelper, expression As String, value As Object, format As String) As IHtmlContent

Parameters

htmlHelper
IHtmlHelper IHtmlHelper IHtmlHelper

The IHtmlHelper instance this method extends.

expression
String String String

Expression name, relative to the current model.

value
Object Object Object

If non-null, value to include in the element.

format
String String String

The format string (see https://msdn.microsoft.com/en-us/library/txafckwd.aspx) used to format the "value" attribute unless that came from model binding.

Returns

A new IHtmlContent containing the <input> element.

Remarks

Combines HtmlFieldPrefix and expression to set <input> element's "name" attribute. Sanitizes expression to set element's "id" attribute.

Applies to