Usato per visualizzare una check box.
Proprietà
| Proprietà |
Descrizione |
| AutoPostBack |
Specifica se il form deve essere inviato non appena
la proprietà checked cambia |
| Checked |
Se è spuntata oppure no |
| id |
L’identificatore del controllo |
| OnCheckedChanged |
La funzione da eseguire quando cambia la proprietà Checked |
| runat |
Specifica quando il conrollo è lato server
(se impostato a “server”) |
| Text |
Il testo accanto alla check box |
| TextAlign |
Da che lato deve apparre il testo accanto alla check
box (right o left) |
Esempio
<script runat="server">
private void controlla(object sender, EventArgs e)
{
if (check1.Checked)
lb1.Text="Controllo checked!";
else
lb1.Text="non checked...";
}
</script>
<html>
<body>
<form runat="server">
<asp:CheckBox id="check1" Text="checkbox"
AutoPostBack="True" OnCheckedChanged="controlla" runat="server" />
<br />
<asp:Label id="lb1" runat="server" / >
</form>
</body>
</html>