Usato per visualizzare un RadioButton
Proprietà
| Proprietà |
Descrizione |
| AutoPostBack |
Specifica se il form deve essere inviato non appena la proprietà checked
cambia |
| Checked |
Se è spuntato |
| id |
Identificativo univoco del controllo |
| GroupName |
Il nome del gruppo a cui appartiene |
| OnCheckedChanged |
La funzione da eseguere quando cambia le stato |
| runat |
Specifica quando il conrollo è lato server (se impostato a “server”) |
| Text |
Il testo associato |
| TextAlign |
Da che lato deve apparire il testo accanto radio button (right
o left) |
Esempio
<script runat="server">
private viod submit(object sender, EventArgs e)
{
if (Uno.Checked)
Label1.Text = "Hai selezionato " + Uno.Text;
else if (Due.Checked)
Label1.Text = "Hai selezionato " + Due.Text;
else if (Tre.Checked)
Label1.Text = "Hai selezionato " + Tre.Text;
}
</script>
<html>
<body>
<form runat="server">
Seleziona una opzione:<br />
<asp:RadioButton id="Uno" Text="Uno" Checked="True" GroupName="options" runat="server"/><br
/>
<asp:RadioButton id="Due" Text="Due" GroupName="options" runat="server"/><br
/>
<asp:RadioButton id="Tre" Text="Tre" GroupName="options" runat="server"/><br
/>
<asp:Button text="Submit" OnClick="invia" runat="server"/>
<p><asp:Label id="Label1" runat="server"/></p>
</form>
</body>
</html>