Non riesco a capire perchè questa routine non funziona:
Sub vis(ByVal obj As Object, ByVal e As EventArgs)
If (maschio.Checked = True) Then
dpmale.Enabled = True
dpfemale.Enabled = False
Else
dpmale.Enabled = False
dpfemale.Enabled = True
End If
End Sub
Il codice è questo:
codice:
<%@ Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Sub vis(ByVal obj As Object, ByVal e As EventArgs)
If (maschio.Checked = True) Then
dpmale.Enabled = True
dpfemale.Enabled = False
Else
dpmale.Enabled = False
dpfemale.Enabled = True
End If
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
Scegli il nome:
Maschio<asp:RadioButton ID="maschio" runat="server" GroupName="sex" onchecked="vis" checked=true AutoPostBack=true>
</asp:RadioButton>
Femmina<asp:RadioButton ID="femmina" runat="server" GroupName="sex" onChecked="vis" autopostback=true>
</asp:RadioButton>
<asp:DropDownList ID="dpmale" name="dmaschile" runat="server" enabled=false>
<asp:ListItem Value="Gino">Gino</asp:ListItem>
<asp:ListItem Value="Bruno">Bruno</asp:ListItem>
<asp:ListItem Value="Tony">Tony</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="dpfemale" name="dfemminile" runat="server" Enabled=false>
<asp:ListItem Value="Tina">Tina</asp:ListItem>
<asp:ListItem Value="Silvia">Silvia</asp:ListItem>
<asp:ListItem Value="Denise">Denise</asp:ListItem>
</asp:DropDownList>
</div>
</form>
</body>
</html>
Potreste aiutarmi? Grazie