Sdílet prostřednictvím


InputExtensions.CheckBox Method

Include Protected Members
Include Inherited Members

Returns a check box input element that enables the user to select a true or false condition.

This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.

Overload List

  Name Description
Public methodStatic member CheckBox(HtmlHelper, String) Returns a check box input element by using the specified HTML helper and the name of the form field.
Public methodStatic member CheckBox(HtmlHelper, String, Boolean) 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 methodStatic member 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 methodStatic member 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 methodStatic member CheckBox(HtmlHelper, String, Boolean, 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 methodStatic member CheckBox(HtmlHelper, String, Boolean, 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.

Top

Remarks

In addition to rendering a check box input element, this method renders a hidden input element so that an unselected check box will return false.

The difference between calling the CheckBox method and using an input element is that the CheckBox method is designed to make it easy to bind to view data or model data.

See Also

Reference

InputExtensions Class

System.Web.Mvc.Html Namespace