HtmlHelper.TextBox(String, Object, String, Object) 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 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:
 virtual Microsoft::AspNetCore::Html::IHtmlContent ^ TextBox(System::String ^ expression, System::Object ^ value, System::String ^ format, System::Object ^ htmlAttributes);
public Microsoft.AspNetCore.Html.IHtmlContent TextBox (string expression, object value, string format, object htmlAttributes);
abstract member TextBox : string * obj * string * obj -> Microsoft.AspNetCore.Html.IHtmlContent
override this.TextBox : string * obj * string * obj -> Microsoft.AspNetCore.Html.IHtmlContent
Public Function TextBox (expression As String, value As Object, format As String, htmlAttributes As Object) As IHtmlContent

Parameters

expression
String

Expression name, relative to the current model.

value
Object

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

format
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.

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