Controls You Can Use on Web Forms ASP.NET Standard Controls CheckBox and CheckBoxList Controls
You can programmatically read or set the value of a CheckBox Web server control.
NOTE: If you are working with a CheckBoxList control, the procedure for getting and setting the value of a check box is different. For details, see Determining the Selection in a List Control and Setting the Selection in a List Control.
To get or set CheckBox Web server control selection, get or set the CheckBox control’s Checked property. A value of true means the check box is selected.
In the following example, if the check box chkSavePassword is not selected, the check box chkSaveEncrypted is automatically cleared as well, and vice-versa.
if ( chkSavePass.Checked ) {
chkSaveEncrypted.Checked = true;
else
chkSaveEncrypted.Checked = false;
}
If chkSavePass.Checked Then
chkSaveEncrypted.Checked = true;
Else
chkSaveEncrypted.Checked = false;
End If |
|
C# |
VB |
Responding to User Selection in a CheckBox Control
|