ASP.NET HtmlInputCheckBox Controls
Definition and Usage
HtmlInputCheckBox control for controlling the <input type = "checkbox"> elements. In HTML, the element used to create a box.
Properties and events
属性 | 描述 |
---|---|
Attributes | 返回该元素的所有属性名称和值对。 |
Checked | 布尔值,规定是否选中该元素。 |
Disabled | 布尔值,指示是否禁用该控件。默认是 false。 |
id | 控件的唯一 id。 |
Name | 元素的名称。 |
runat | 规定该控件是一个服务器控件。必须被设置为 "server"。 |
Style | 设置或返回被应用到控件的 CSS 属性。 |
TagName | 返回元素的标签名。 |
Type | 元素的类型。 |
Value | 元素的值。 |
Visible | 布尔值,指示该控件是否可见。 |
事件 | 描述 |
---|---|
ServerChange | 当控件状态改变时发生此事件。 |
Examples
HTMLInputCheckbox
In this example, we declare two HtmlInputCheckBox control in an .aspx file, a HtmlInputButton control, and one HtmlGeneric control (remember to control nested HtmlForm control). When the submit button is triggered, the submit subroutine is executed. The submit subroutine response in two ways: If the "red" check box is selected, the server sends a message to the p element "You prefer red!". If the "blue" box is checked, the server sends a message to the p element "You prefer blue!".
HTML server controls