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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe 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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field.
isChecked
booltrue 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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field.
isChecked
booltrue 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.
htmlAttributes
IDictionary<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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field.
isChecked
booltrue 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.
htmlAttributes
objectAn 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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field.
htmlAttributes
IDictionary<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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field.
htmlAttributes
objectAn 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
htmlHelper
HtmlHelper<TModel>The HTML helper instance that this method extends.
expression
Expression<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
TModel
The type of the model.
Exceptions
- ArgumentNullException
The
expression
parameter 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
htmlHelper
HtmlHelper<TModel>The HTML helper instance that this method extends.
expression
Expression<Func<TModel, bool>>An expression that identifies the object that contains the properties to render.
htmlAttributes
IDictionary<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
TModel
The type of the model.
Exceptions
- ArgumentNullException
The
expression
parameter 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
htmlHelper
HtmlHelper<TModel>The HTML helper instance that this method extends.
expression
Expression<Func<TModel, bool>>An expression that identifies the object that contains the properties to render.
htmlAttributes
objectAn 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
TModel
The type of the model.
Exceptions
- ArgumentNullException
The
expression
parameter 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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe 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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
value
objectThe 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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
value
objectThe 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.
htmlAttributes
IDictionary<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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
value
objectThe 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.
htmlAttributes
objectAn 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
htmlHelper
HtmlHelper<TModel>The HTML helper instance that this method extends.
expression
Expression<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
TModel
The type of the model.
TProperty
The 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
htmlHelper
HtmlHelper<TModel>The HTML helper instance that this method extends.
expression
Expression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to render.
htmlAttributes
IDictionary<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
TModel
The type of the model.
TProperty
The 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
htmlHelper
HtmlHelper<TModel>The HTML helper instance that this method extends.
expression
Expression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to render.
htmlAttributes
objectAn 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
TModel
The type of the model.
TProperty
The 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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe 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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
value
objectThe 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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
value
objectThe 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.
htmlAttributes
IDictionary<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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
value
objectThe 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.
htmlAttributes
objectAn 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
htmlHelper
HtmlHelper<TModel>The HTML helper instance that this method extends.
expression
Expression<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
TModel
The type of the model.
TProperty
The type of the value.
Exceptions
- ArgumentNullException
The
expression
parameter 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
htmlHelper
HtmlHelper<TModel>The HTML helper instance that this method extends.
expression
Expression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to render.
htmlAttributes
IDictionary<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
TModel
The type of the model.
TProperty
The type of the value.
Exceptions
- ArgumentNullException
The
expression
parameter 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
htmlHelper
HtmlHelper<TModel>The HTML helper instance that this method extends.
expression
Expression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to render.
htmlAttributes
objectAn 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
TModel
The type of the model.
TProperty
The type of the value.
Exceptions
- ArgumentNullException
The
expression
parameter 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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
value
objectThe 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
name
parameter is null or empty.- ArgumentNullException
The
value
parameter 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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
value
objectThe 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.
isChecked
booltrue to select the radio button; otherwise, false.
Returns
- MvcHtmlString
An input element whose type attribute is set to "radio".
Exceptions
- ArgumentException
The
name
parameter is null or empty.- ArgumentNullException
The
value
parameter 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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
value
objectThe 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.
isChecked
booltrue to select the radio button; otherwise, false.
htmlAttributes
IDictionary<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
name
parameter is null or empty.- ArgumentNullException
The
value
parameter 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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
value
objectThe 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.
isChecked
booltrue to select the radio button; otherwise, false.
htmlAttributes
objectAn 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
name
parameter is null or empty.- ArgumentNullException
The
value
parameter 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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
value
objectThe 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.
htmlAttributes
IDictionary<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
name
parameter is null or empty.- ArgumentNullException
The
value
parameter 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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
value
objectThe 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.
htmlAttributes
objectAn 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
name
parameter is null or empty.- ArgumentNullException
The
value
parameter 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
htmlHelper
HtmlHelper<TModel>The HTML helper instance that this method extends.
expression
Expression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to render.
value
objectThe 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
TModel
The type of the model.
TProperty
The type of the value.
Exceptions
- ArgumentNullException
The
value
parameter 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
htmlHelper
HtmlHelper<TModel>The HTML helper instance that this method extends.
expression
Expression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to render.
value
objectThe 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.
htmlAttributes
IDictionary<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
TModel
The type of the model.
TProperty
The type of the value.
Exceptions
- ArgumentNullException
The
value
parameter 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
htmlHelper
HtmlHelper<TModel>The HTML helper instance that this method extends.
expression
Expression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to render.
value
objectThe 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.
htmlAttributes
objectAn 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
TModel
The type of the model.
TProperty
The type of the value.
Exceptions
- ArgumentNullException
The
value
parameter 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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe 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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
value
objectThe 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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
value
objectThe 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.
htmlAttributes
IDictionary<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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
value
objectThe 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.
htmlAttributes
objectAn 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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field.
value
objectThe 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.
format
stringA 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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
value
objectThe 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.
format
stringA string that is used to format the input.
htmlAttributes
IDictionary<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
htmlHelper
HtmlHelperThe HTML helper instance that this method extends.
name
stringThe name of the form field and the ViewDataDictionary key that is used to look up the value.
value
objectThe 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.
format
stringA string that is used to format the input.
htmlAttributes
objectAn 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
htmlHelper
HtmlHelper<TModel>The HTML helper instance that this method extends.
expression
Expression<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
TModel
The type of the model.
TProperty
The type of the value.
Exceptions
- ArgumentException
The
expression
parameter 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
htmlHelper
HtmlHelper<TModel>The HTML helper instance that this method extends.
expression
Expression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to render.
htmlAttributes
IDictionary<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
TModel
The type of the model.
TProperty
The type of the value.
Exceptions
- ArgumentException
The
expression
parameter 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
htmlHelper
HtmlHelper<TModel>The HTML helper instance that this method extends.
expression
Expression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to render.
htmlAttributes
objectAn 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
TModel
The type of the model.
TProperty
The type of the value.
Exceptions
- ArgumentException
The
expression
parameter 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
htmlHelper
HtmlHelper<TModel>The HTML helper instance that this method extends.
expression
Expression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to display.
format
stringA string that is used to format the input.
Returns
- MvcHtmlString
An input element whose type attribute is set to "text".
Type Parameters
TModel
The type of the model.
TProperty
The 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
htmlHelper
HtmlHelper<TModel>The HTML helper instance that this method extends.
expression
Expression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to display.
format
stringA string that is used to format the input.
htmlAttributes
IDictionary<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
TModel
The type of the model.
TProperty
The 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
htmlHelper
HtmlHelper<TModel>The HTML helper instance that this method extends.
expression
Expression<Func<TModel, TProperty>>An expression that identifies the object that contains the properties to display.
format
stringA string that is used to format the input.
htmlAttributes
objectAn 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
TModel
The type of the model.
TProperty
The type of the value.