Class InputExtensions
Represents support for HTML input controls in an application.
public static class InputExtensions
- Inheritance
-
InputExtensions
- Inherited Members
Methods
CheckBox(HtmlHelper, string)
Returns a check box input element by using the specified HTML helper and the name of the form field.
public static MvcHtmlString CheckBox(this HtmlHelper htmlHelper, string name)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field.
Returns
- MvcHtmlString
An input element whose type attribute is set to "checkbox".
CheckBox(HtmlHelper, string, bool)
Returns a check box input element by using the specified HTML helper, the name of the form field, and a value to indicate whether the check box is selected.
public static MvcHtmlString CheckBox(this HtmlHelper htmlHelper, string name, bool isChecked)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field.
isCheckedbooltrue to select the check box; otherwise, false. The value of the check box is retrieved in this order - the ModelStateDictionary object, the value of this parameter, the ViewDataDictionary object, and lastly, a checked attribute in the html attributes.
Returns
- MvcHtmlString
An input element whose type attribute is set to "checkbox".
CheckBox(HtmlHelper, string, bool, IDictionary<string, object>)
Returns a check box input element by using the specified HTML helper, the name of the form field, a value to indicate whether the check box is selected, and the HTML attributes.
public static MvcHtmlString CheckBox(this HtmlHelper htmlHelper, string name, bool isChecked, IDictionary<string, object> htmlAttributes)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field.
isCheckedbooltrue to select the check box; otherwise, false. The value of the check box is retrieved in this order - the ModelStateDictionary object, the value of this parameter, the ViewDataDictionary object, and lastly, a checked attribute in the html attributes.
htmlAttributesIDictionary<string, object>An object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An input element whose type attribute is set to "checkbox".
CheckBox(HtmlHelper, string, bool, object)
Returns a check box input element by using the specified HTML helper, the name of the form field, a value that indicates whether the check box is selected, and the HTML attributes.
public static MvcHtmlString CheckBox(this HtmlHelper htmlHelper, string name, bool isChecked, object htmlAttributes)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field.
isCheckedbooltrue to select the check box; otherwise, false. The value of the check box is retrieved in this order - the ModelStateDictionary object, the value of this parameter, the ViewDataDictionary object, and lastly, a checked attribute in the html attributes.
htmlAttributesobjectAn object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An input element whose type attribute is set to "checkbox".
CheckBox(HtmlHelper, string, IDictionary<string, object>)
Returns a check box input element by using the specified HTML helper, the name of the form field, and the HTML attributes.
public static MvcHtmlString CheckBox(this HtmlHelper htmlHelper, string name, IDictionary<string, object> htmlAttributes)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field.
htmlAttributesIDictionary<string, object>An object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An input element whose type attribute is set to "checkbox".
CheckBox(HtmlHelper, string, object)
Returns a check box input element by using the specified HTML helper, the name of the form field, and the HTML attributes.
public static MvcHtmlString CheckBox(this HtmlHelper htmlHelper, string name, object htmlAttributes)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field.
htmlAttributesobjectAn object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An input element whose type attribute is set to "checkbox".
CheckBoxFor<TModel>(HtmlHelper<TModel>, Expression<Func<TModel, bool>>)
Returns a check box input element for each property in the object that is represented by the specified expression.
public static MvcHtmlString CheckBoxFor<TModel>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, bool>> expression)
Parameters
htmlHelperHtmlHelper<TModel>The HTML helper instance that this method extends.
expressionExpression<Func<TModel, bool>>An expression that identifies the object that contains the properties to render.
Returns
- MvcHtmlString
An HTML input element whose type attribute is set to "checkbox" for each property in the object that is represented by the specified expression.
Type Parameters
TModelThe type of the model.
Exceptions
- ArgumentNullException
The
expressionparameter is null.
CheckBoxFor<TModel>(HtmlHelper<TModel>, Expression<Func<TModel, bool>>, IDictionary<string, object>)
Returns a check box input element for each property in the object that is represented by the specified expression, using the specified HTML attributes.
public static MvcHtmlString CheckBoxFor<TModel>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, bool>> expression, IDictionary<string, object> htmlAttributes)
Parameters
htmlHelperHtmlHelper<TModel>The HTML helper instance that this method extends.
expressionExpression<Func<TModel, bool>>An expression that identifies the object that contains the properties to render.
htmlAttributesIDictionary<string, object>A dictionary that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An HTML input element whose type attribute is set to "checkbox" for each property in the object that is represented by the specified expression, using the specified HTML attributes.
Type Parameters
TModelThe type of the model.
Exceptions
- ArgumentNullException
The
expressionparameter is null.
CheckBoxFor<TModel>(HtmlHelper<TModel>, Expression<Func<TModel, bool>>, object)
Returns a check box input element for each property in the object that is represented by the specified expression, using the specified HTML attributes.
public static MvcHtmlString CheckBoxFor<TModel>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, bool>> expression, object htmlAttributes)
Parameters
htmlHelperHtmlHelper<TModel>The HTML helper instance that this method extends.
expressionExpression<Func<TModel, bool>>An expression that identifies the object that contains the properties to render.
htmlAttributesobjectAn object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An HTML input element whose type attribute is set to "checkbox" for each property in the object that is represented by the specified expression, using the specified HTML attributes.
Type Parameters
TModelThe type of the model.
Exceptions
- ArgumentNullException
The
expressionparameter is null.
Hidden(HtmlHelper, string)
Returns a hidden input element by using the specified HTML helper and the name of the form field.
public static MvcHtmlString Hidden(this HtmlHelper htmlHelper, string name)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
Returns
- MvcHtmlString
An input element whose type attribute is set to "hidden".
Hidden(HtmlHelper, string, object)
Returns a hidden input element by using the specified HTML helper, the name of the form field, and the value.
public static MvcHtmlString Hidden(this HtmlHelper htmlHelper, string name, object value)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
valueobjectThe value of the hidden input element. The value is retrieved in this order - the ModelStateDictionary object, the value of this parameter, the ViewDataDictionary object, and lastly, a value attribute in the html attributes.
Returns
- MvcHtmlString
An input element whose type attribute is set to "hidden".
Hidden(HtmlHelper, string, object, IDictionary<string, object>)
Returns a hidden input element by using the specified HTML helper, the name of the form field, the value, and the HTML attributes.
public static MvcHtmlString Hidden(this HtmlHelper htmlHelper, string name, object value, IDictionary<string, object> htmlAttributes)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
valueobjectThe value of the hidden input element. The value is retrieved in this order - the ModelStateDictionary object, the value of this parameter, the ViewDataDictionary object, and lastly, a value attribute in the html attributes.
htmlAttributesIDictionary<string, object>An object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An input element whose type attribute is set to "hidden".
Hidden(HtmlHelper, string, object, object)
Returns a hidden input element by using the specified HTML helper, the name of the form field, the value, and the HTML attributes.
public static MvcHtmlString Hidden(this HtmlHelper htmlHelper, string name, object value, object htmlAttributes)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
valueobjectThe value of the hidden input element. The value is retrieved in this order - the ModelStateDictionary object, the value of this parameter, the ViewDataDictionary object, and lastly, a value attribute in the html attributes.
htmlAttributesobjectAn object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An input element whose type attribute is set to "hidden".
HiddenFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>)
Returns an HTML hidden input element for each property in the object that is represented by the specified expression.
public static MvcHtmlString HiddenFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression)
Parameters
htmlHelperHtmlHelper<TModel>The HTML helper instance that this method extends.
expressionExpression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to render.
Returns
- MvcHtmlString
An input element whose type attribute is set to "hidden" for each property in the object that is represented by the expression.
Type Parameters
TModelThe type of the model.
TPropertyThe type of the property.
HiddenFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, IDictionary<string, object>)
Returns an HTML hidden input element for each property in the object that is represented by the specified expression, using the specified HTML attributes.
public static MvcHtmlString HiddenFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, IDictionary<string, object> htmlAttributes)
Parameters
htmlHelperHtmlHelper<TModel>The HTML helper instance that this method extends.
expressionExpression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to render.
htmlAttributesIDictionary<string, object>An object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An input element whose type attribute is set to "hidden" for each property in the object that is represented by the expression.
Type Parameters
TModelThe type of the model.
TPropertyThe type of the property.
HiddenFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, object)
Returns an HTML hidden input element for each property in the object that is represented by the specified expression, using the specified HTML attributes.
public static MvcHtmlString HiddenFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, object htmlAttributes)
Parameters
htmlHelperHtmlHelper<TModel>The HTML helper instance that this method extends.
expressionExpression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to render.
htmlAttributesobjectAn object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An input element whose type attribute is set to "hidden" for each property in the object that is represented by the expression.
Type Parameters
TModelThe type of the model.
TPropertyThe type of the property.
Password(HtmlHelper, string)
Returns a password input element by using the specified HTML helper and the name of the form field.
public static MvcHtmlString Password(this HtmlHelper htmlHelper, string name)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
Returns
- MvcHtmlString
An input element whose type attribute is set to "password".
Password(HtmlHelper, string, object)
Returns a password input element by using the specified HTML helper, the name of the form field, and the value.
public static MvcHtmlString Password(this HtmlHelper htmlHelper, string name, object value)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
valueobjectThe value of the password input element. If a value for this parameter is not provided, the value attribute in the html attributes is used to retrieve the value.
Returns
- MvcHtmlString
An input element whose type attribute is set to "password".
Password(HtmlHelper, string, object, IDictionary<string, object>)
Returns a password input element by using the specified HTML helper, the name of the form field, the value, and the HTML attributes.
public static MvcHtmlString Password(this HtmlHelper htmlHelper, string name, object value, IDictionary<string, object> htmlAttributes)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
valueobjectThe value of the password input element. If a value for this parameter is not provided, the value attribute in the html attributes is used to retrieve the value.
htmlAttributesIDictionary<string, object>An object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An input element whose type attribute is set to "password".
Password(HtmlHelper, string, object, object)
Returns a password input element by using the specified HTML helper, the name of the form field, the value, and the HTML attributes.
public static MvcHtmlString Password(this HtmlHelper htmlHelper, string name, object value, object htmlAttributes)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
valueobjectThe value of the password input element. If a value for this parameter is not provided, the value attribute in the html attributes is used to retrieve the value.
htmlAttributesobjectAn object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An input element whose type attribute is set to "password".
PasswordFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>)
Returns a password input element for each property in the object that is represented by the specified expression.
public static MvcHtmlString PasswordFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression)
Parameters
htmlHelperHtmlHelper<TModel>The HTML helper instance that this method extends.
expressionExpression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to render.
Returns
- MvcHtmlString
An HTML input element whose type attribute is set to "password" for each property in the object that is represented by the specified expression.
Type Parameters
TModelThe type of the model.
TPropertyThe type of the value.
Exceptions
- ArgumentNullException
The
expressionparameter is null.
PasswordFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, IDictionary<string, object>)
Returns a password input element for each property in the object that is represented by the specified expression, using the specified HTML attributes.
public static MvcHtmlString PasswordFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, IDictionary<string, object> htmlAttributes)
Parameters
htmlHelperHtmlHelper<TModel>The HTML helper instance that this method extends.
expressionExpression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to render.
htmlAttributesIDictionary<string, object>A dictionary that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An HTML input element whose type attribute is set to "password" for each property in the object that is represented by the specified expression, using the specified HTML attributes.
Type Parameters
TModelThe type of the model.
TPropertyThe type of the value.
Exceptions
- ArgumentNullException
The
expressionparameter is null.
PasswordFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, object)
Returns a password input element for each property in the object that is represented by the specified expression, using the specified HTML attributes.
public static MvcHtmlString PasswordFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, object htmlAttributes)
Parameters
htmlHelperHtmlHelper<TModel>The HTML helper instance that this method extends.
expressionExpression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to render.
htmlAttributesobjectAn object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An HTML input element whose type attribute is set to "password" for each property in the object that is represented by the specified expression, using the specified HTML attributes.
Type Parameters
TModelThe type of the model.
TPropertyThe type of the value.
Exceptions
- ArgumentNullException
The
expressionparameter is null.
RadioButton(HtmlHelper, string, object)
Returns a radio button input element that is used to present mutually exclusive options.
public static MvcHtmlString RadioButton(this HtmlHelper htmlHelper, string name, object value)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
valueobjectThe value of the selected radio button. The value is retrieved in this order - the ModelStateDictionary object, the value of this parameter, the ViewDataDictionary object, and lastly, a value attribute in the html attributes.
Returns
- MvcHtmlString
An input element whose type attribute is set to "radio".
Exceptions
- ArgumentException
The
nameparameter is null or empty.- ArgumentNullException
The
valueparameter is null.
RadioButton(HtmlHelper, string, object, bool)
Returns a radio button input element that is used to present mutually exclusive options.
public static MvcHtmlString RadioButton(this HtmlHelper htmlHelper, string name, object value, bool isChecked)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
valueobjectThe value of the selected radio button. The value is retrieved in this order - the ModelStateDictionary object, the value of this parameter, the ViewDataDictionary object, and lastly, a value attribute in the html attributes.
isCheckedbooltrue to select the radio button; otherwise, false.
Returns
- MvcHtmlString
An input element whose type attribute is set to "radio".
Exceptions
- ArgumentException
The
nameparameter is null or empty.- ArgumentNullException
The
valueparameter is null.
RadioButton(HtmlHelper, string, object, bool, IDictionary<string, object>)
Returns a radio button input element that is used to present mutually exclusive options.
public static MvcHtmlString RadioButton(this HtmlHelper htmlHelper, string name, object value, bool isChecked, IDictionary<string, object> htmlAttributes)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
valueobjectThe value of the selected radio button. The value is retrieved in this order - the ModelStateDictionary object, the value of this parameter, the ViewDataDictionary object, and lastly, a value attribute in the html attributes.
isCheckedbooltrue to select the radio button; otherwise, false.
htmlAttributesIDictionary<string, object>An object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An input element whose type attribute is set to "radio".
Exceptions
- ArgumentException
The
nameparameter is null or empty.- ArgumentNullException
The
valueparameter is null.
RadioButton(HtmlHelper, string, object, bool, object)
Returns a radio button input element that is used to present mutually exclusive options.
public static MvcHtmlString RadioButton(this HtmlHelper htmlHelper, string name, object value, bool isChecked, object htmlAttributes)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
valueobjectThe value of the selected radio button. The value is retrieved in this order - the ModelStateDictionary object, the value of this parameter, the ViewDataDictionary object, and lastly, a value attribute in the html attributes.
isCheckedbooltrue to select the radio button; otherwise, false.
htmlAttributesobjectAn object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An input element whose type attribute is set to "radio".
Exceptions
- ArgumentException
The
nameparameter is null or empty.- ArgumentNullException
The
valueparameter is null.
RadioButton(HtmlHelper, string, object, IDictionary<string, object>)
Returns a radio button input element that is used to present mutually exclusive options.
public static MvcHtmlString RadioButton(this HtmlHelper htmlHelper, string name, object value, IDictionary<string, object> htmlAttributes)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
valueobjectThe value of the selected radio button. The value is retrieved in this order - the ModelStateDictionary object, the value of this parameter, the ViewDataDictionary object, and lastly, a value attribute in the html attributes.
htmlAttributesIDictionary<string, object>An object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An input element whose type attribute is set to "radio".
Exceptions
- ArgumentException
The
nameparameter is null or empty.- ArgumentNullException
The
valueparameter is null.
RadioButton(HtmlHelper, string, object, object)
Returns a radio button input element that is used to present mutually exclusive options.
public static MvcHtmlString RadioButton(this HtmlHelper htmlHelper, string name, object value, object htmlAttributes)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
valueobjectThe value of the selected radio button. The value is retrieved in this order - the ModelStateDictionary object, the value of this parameter, the ViewDataDictionary object, and lastly, a value attribute in the html attributes.
htmlAttributesobjectAn object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An input element whose type attribute is set to "radio".
Exceptions
- ArgumentException
The
nameparameter is null or empty.- ArgumentNullException
The
valueparameter is null.
RadioButtonFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, object)
Returns a radio button input element for each property in the object that is represented by the specified expression.
public static MvcHtmlString RadioButtonFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, object value)
Parameters
htmlHelperHtmlHelper<TModel>The HTML helper instance that this method extends.
expressionExpression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to render.
valueobjectThe value of the selected radio button. The value is retrieved in this order - the ModelStateDictionary object, the value of this parameter, the ViewDataDictionary object, and lastly, a value attribute in the html attributes.
Returns
- MvcHtmlString
An HTML input element whose type attribute is set to "radio" for each property in the object that is represented by the specified expression.
Type Parameters
TModelThe type of the model.
TPropertyThe type of the value.
Exceptions
- ArgumentNullException
The
valueparameter is null.
RadioButtonFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, object, IDictionary<string, object>)
Returns a radio button input element for each property in the object that is represented by the specified expression, using the specified HTML attributes.
public static MvcHtmlString RadioButtonFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, object value, IDictionary<string, object> htmlAttributes)
Parameters
htmlHelperHtmlHelper<TModel>The HTML helper instance that this method extends.
expressionExpression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to render.
valueobjectThe value of the selected radio button. The value is retrieved in this order - the ModelStateDictionary object, the value of this parameter, the ViewDataDictionary object, and lastly, a value attribute in the html attributes.
htmlAttributesIDictionary<string, object>A dictionary that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An HTML input element whose type attribute is set to "radio" for each property in the object that is represented by the specified expression, using the specified HTML attributes.
Type Parameters
TModelThe type of the model.
TPropertyThe type of the value.
Exceptions
- ArgumentNullException
The
valueparameter is null.
RadioButtonFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, object, object)
Returns a radio button input element for each property in the object that is represented by the specified expression, using the specified HTML attributes.
public static MvcHtmlString RadioButtonFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, object value, object htmlAttributes)
Parameters
htmlHelperHtmlHelper<TModel>The HTML helper instance that this method extends.
expressionExpression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to render.
valueobjectThe value of the selected radio button. The value is retrieved in this order - the ModelStateDictionary object, the value of this parameter, the ViewDataDictionary object, and lastly, a value attribute in the html attributes.
htmlAttributesobjectAn object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An HTML input element whose type attribute is set to "radio" for each property in the object that is represented by the specified expression, using the specified HTML attributes.
Type Parameters
TModelThe type of the model.
TPropertyThe type of the value.
Exceptions
- ArgumentNullException
The
valueparameter is null.
TextBox(HtmlHelper, string)
Returns a text input element by using the specified HTML helper and the name of the form field.
public static MvcHtmlString TextBox(this HtmlHelper htmlHelper, string name)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
Returns
- MvcHtmlString
An input element whose type attribute is set to "text".
TextBox(HtmlHelper, string, object)
Returns a text input element by using the specified HTML helper, the name of the form field, and the value.
public static MvcHtmlString TextBox(this HtmlHelper htmlHelper, string name, object value)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
valueobjectThe value of the text input element. The value is retrieved in this order - the ModelStateDictionary object, the value of this parameter, the ViewDataDictionary object, and lastly, a value attribute in the html attributes.
Returns
- MvcHtmlString
An input element whose type attribute is set to "text".
TextBox(HtmlHelper, string, object, IDictionary<string, object>)
Returns a text input element by using the specified HTML helper, the name of the form field, the value, and the HTML attributes.
public static MvcHtmlString TextBox(this HtmlHelper htmlHelper, string name, object value, IDictionary<string, object> htmlAttributes)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
valueobjectThe value of the text input element. The value is retrieved in this order - the ModelStateDictionary object, the value of this parameter, the ViewDataDictionary object, and lastly, a value attribute in the html attributes.
htmlAttributesIDictionary<string, object>An object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An input element whose type attribute is set to "text".
TextBox(HtmlHelper, string, object, object)
Returns a text input element by using the specified HTML helper, the name of the form field, the value, and the HTML attributes.
public static MvcHtmlString TextBox(this HtmlHelper htmlHelper, string name, object value, object htmlAttributes)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
valueobjectThe value of the text input element. The value is retrieved in this order - the ModelStateDictionary object, the value of this parameter, the ViewDataDictionary object, and lastly, a value attribute in the html attributes.
htmlAttributesobjectAn object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An input element whose type attribute is set to "text".
TextBox(HtmlHelper, string, object, string)
Returns a text input element.
public static MvcHtmlString TextBox(this HtmlHelper htmlHelper, string name, object value, string format)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field.
valueobjectThe value of the text input element. The value is retrieved in this order - the ModelStateDictionary object, the value of this parameter, the ViewDataDictionary object, and lastly, a value attribute in the html attributes.
formatstringA string that is used to format the input.
Returns
- MvcHtmlString
An input element whose type attribute is set to "text".
TextBox(HtmlHelper, string, object, string, IDictionary<string, object>)
Returns a text input element.
public static MvcHtmlString TextBox(this HtmlHelper htmlHelper, string name, object value, string format, IDictionary<string, object> htmlAttributes)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
valueobjectThe value of the text input element. The value is retrieved in this order - the ModelStateDictionary object, the value of this parameter, the ViewDataDictionary object, and lastly, a value attribute in the html attributes.
formatstringA string that is used to format the input.
htmlAttributesIDictionary<string, object>An object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An input element whose type attribute is set to "text".
TextBox(HtmlHelper, string, object, string, object)
Returns a text input element.
public static MvcHtmlString TextBox(this HtmlHelper htmlHelper, string name, object value, string format, object htmlAttributes)
Parameters
htmlHelperHtmlHelperThe HTML helper instance that this method extends.
namestringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
valueobjectThe value of the text input element. The value is retrieved in this order - the ModelStateDictionary object, the value of this parameter, the ViewDataDictionary object, and lastly, a value attribute in the html attributes.
formatstringA string that is used to format the input.
htmlAttributesobjectAn object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An input element whose type attribute is set to "text".
TextBoxFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>)
Returns a text input element for each property in the object that is represented by the specified expression.
public static MvcHtmlString TextBoxFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression)
Parameters
htmlHelperHtmlHelper<TModel>The HTML helper instance that this method extends.
expressionExpression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to render.
Returns
- MvcHtmlString
An HTML input element whose type attribute is set to "text" for each property in the object that is represented by the expression.
Type Parameters
TModelThe type of the model.
TPropertyThe type of the value.
Exceptions
- ArgumentException
The
expressionparameter is null or empty.
TextBoxFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, IDictionary<string, object>)
Returns a text input element for each property in the object that is represented by the specified expression, using the specified HTML attributes.
public static MvcHtmlString TextBoxFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, IDictionary<string, object> htmlAttributes)
Parameters
htmlHelperHtmlHelper<TModel>The HTML helper instance that this method extends.
expressionExpression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to render.
htmlAttributesIDictionary<string, object>A dictionary that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An HTML input element type attribute is set to "text" for each property in the object that is represented by the expression.
Type Parameters
TModelThe type of the model.
TPropertyThe type of the value.
Exceptions
- ArgumentException
The
expressionparameter is null or empty.
TextBoxFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<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.
public static MvcHtmlString TextBoxFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, object htmlAttributes)
Parameters
htmlHelperHtmlHelper<TModel>The HTML helper instance that this method extends.
expressionExpression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to render.
htmlAttributesobjectAn object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An HTML input element whose type attribute is set to "text" for each property in the object that is represented by the expression.
Type Parameters
TModelThe type of the model.
TPropertyThe type of the value.
Exceptions
- ArgumentException
The
expressionparameter is null or empty.
TextBoxFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, string)
Returns a text input element.
public static MvcHtmlString TextBoxFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, string format)
Parameters
htmlHelperHtmlHelper<TModel>The HTML helper instance that this method extends.
expressionExpression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to display.
formatstringA string that is used to format the input.
Returns
- MvcHtmlString
An input element whose type attribute is set to "text".
Type Parameters
TModelThe type of the model.
TPropertyThe type of the value.
TextBoxFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, string, IDictionary<string, object>)
Returns a text input element.
public static MvcHtmlString TextBoxFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, string format, IDictionary<string, object> htmlAttributes)
Parameters
htmlHelperHtmlHelper<TModel>The HTML helper instance that this method extends.
expressionExpression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to display.
formatstringA string that is used to format the input.
htmlAttributesIDictionary<string, object>An object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An input element whose type attribute is set to "text".
Type Parameters
TModelThe type of the model.
TPropertyThe type of the value.
TextBoxFor<TModel, TProperty>(HtmlHelper<TModel>, Expression<Func<TModel, TProperty>>, string, object)
Returns a text input element.
public static MvcHtmlString TextBoxFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, string format, object htmlAttributes)
Parameters
htmlHelperHtmlHelper<TModel>The HTML helper instance that this method extends.
expressionExpression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to display.
formatstringA string that is used to format the input.
htmlAttributesobjectAn object that contains the HTML attributes to set for the element.
Returns
- MvcHtmlString
An input element whose type attribute is set to "text".
Type Parameters
TModelThe type of the model.
TPropertyThe type of the value.