HtmlHelper.CheckBox Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
CheckBox(String) |
Returns an HTML check box control that has the specified name. |
CheckBox(String, Boolean) |
Returns an HTML check box control that has the specified name and default checked status. |
CheckBox(String, IDictionary<String,Object>) |
Returns an HTML check box control that has the specified name and custom attributes defined by an attribute dictionary. |
CheckBox(String, Object) |
Returns an HTML check box control that has the specified name and custom attributes defined by an attribute object. |
CheckBox(String, Boolean, IDictionary<String,Object>) |
Returns an HTML check box control that has the specified name, default checked status, and custom attributes defined by an attribute dictionary. |
CheckBox(String, Boolean, Object) |
Returns an HTML check box control that has the specified name, default checked status, and custom attributes defined by an attribute object. |
CheckBox(String)
Returns an HTML check box control that has the specified name.
public System.Web.IHtmlString CheckBox (string name);
member this.CheckBox : string -> System.Web.IHtmlString
Public Function CheckBox (name As String) As IHtmlString
Parameters
- name
- String
The value to assign to the name attribute of the HTML control element.
Returns
The HTML markup that represents the check box control.
Exceptions
name
is null or empty.
Applies to
CheckBox(String, Boolean)
Returns an HTML check box control that has the specified name and default checked status.
public System.Web.IHtmlString CheckBox (string name, bool isChecked);
member this.CheckBox : string * bool -> System.Web.IHtmlString
Public Function CheckBox (name As String, isChecked As Boolean) As IHtmlString
Parameters
- name
- String
The value to assign to the name attribute of the HTML control element.
- isChecked
- Boolean
true to indicate that the checked attribute is set to checked; otherwise, false.
Returns
The HTML markup that represents the check box control.
Exceptions
name
is null or empty.
Applies to
CheckBox(String, IDictionary<String,Object>)
Returns an HTML check box control that has the specified name and custom attributes defined by an attribute dictionary.
public System.Web.IHtmlString CheckBox (string name, System.Collections.Generic.IDictionary<string,object> htmlAttributes);
member this.CheckBox : string * System.Collections.Generic.IDictionary<string, obj> -> System.Web.IHtmlString
Public Function CheckBox (name As String, htmlAttributes As IDictionary(Of String, Object)) As IHtmlString
Parameters
- name
- String
The value to assign to the name attribute of the HTML control element.
- htmlAttributes
- IDictionary<String,Object>
The names and values of custom attributes for the element.
Returns
The HTML markup that represents the check box control.
Exceptions
name
is null or empty.
Applies to
CheckBox(String, Object)
Returns an HTML check box control that has the specified name and custom attributes defined by an attribute object.
public System.Web.IHtmlString CheckBox (string name, object htmlAttributes);
member this.CheckBox : string * obj -> System.Web.IHtmlString
Public Function CheckBox (name As String, htmlAttributes As Object) As IHtmlString
Parameters
- name
- String
The value to assign to the name attribute of the HTML control element.
- htmlAttributes
- Object
An object that contains custom attributes for the element. The attribute names and values are retrieved through reflection by examining the properties of the object.
Returns
The HTML markup that represents the check box control.
Exceptions
name
is null or empty.
Applies to
CheckBox(String, Boolean, IDictionary<String,Object>)
Returns an HTML check box control that has the specified name, default checked status, and custom attributes defined by an attribute dictionary.
public System.Web.IHtmlString CheckBox (string name, bool isChecked, System.Collections.Generic.IDictionary<string,object> htmlAttributes);
member this.CheckBox : string * bool * System.Collections.Generic.IDictionary<string, obj> -> System.Web.IHtmlString
Public Function CheckBox (name As String, isChecked As Boolean, htmlAttributes As IDictionary(Of String, Object)) As IHtmlString
Parameters
- name
- String
The value to assign to the name attribute of the HTML control element.
- isChecked
- Boolean
true to indicate that the checked attribute is set to checked; otherwise, false.
- htmlAttributes
- IDictionary<String,Object>
The names and values of custom attributes for the element.
Returns
The HTML markup that represents the check box control.
Exceptions
name
is null or empty.
Applies to
CheckBox(String, Boolean, Object)
Returns an HTML check box control that has the specified name, default checked status, and custom attributes defined by an attribute object.
public System.Web.IHtmlString CheckBox (string name, bool isChecked, object htmlAttributes);
member this.CheckBox : string * bool * obj -> System.Web.IHtmlString
Public Function CheckBox (name As String, isChecked As Boolean, htmlAttributes As Object) As IHtmlString
Parameters
- name
- String
The value to assign to the name attribute of the HTML control element.
- isChecked
- Boolean
true to indicate that the checked attribute is set to checked; otherwise, false.
- htmlAttributes
- Object
An object that contains custom attributes for the element. The attribute names and values are retrieved through reflection by examining the properties of the object.
Returns
The HTML markup that represents the check box control.
Exceptions
name
is null or empty.