Morpheusweb.it - Risorse per webmaster: script, ASP.NET, C#, Visual Basic .Net, tutorial, asp, javascript, css, php, html, java, ADO, VBScript, forms, frames, Active Server Pages, Dynamic HTML, database, gratis per webmaster e webdesigner

Il Controllo CheckBox di ASP.Net

Controllo CheckBox


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>


Stampa la pagina


 

Inizio pagina

risorse per webmaster