Ho un problema con le combo, questo è il mio codice e io vorrei sapere come faccio a fare un controllo per sapere se è stato selezionato almeno un elemento dalla combo lista1!
Come posso fare?
lista1.SelectedItem.Selected ???
codice:
<%@ Page Language="VB" aspCompat="True"%>
<script runat=server>
sub trasferisci(obj as object, e as eventargs)
select case obj.id
case "inserisci"
Response.write(lista1.SelectedItem.Value)
case "togli"
'niente
end select
end sub
</script>
<HTML>
<HEAD>
<title>Prova</title>
</HEAD>
<body>
<form runat="server">
<table align="center">
<tr>
<td>
<asp:ListBox ID="lista1" Runat="server" SelectionMode="Single">
<asp:ListItem Value="TN">Trento</asp:ListItem>
<asp:ListItem Value="BZ">Bolzano</asp:ListItem>
<asp:ListItem Value="MI">Milano</asp:ListItem>
</asp:ListBox>
</td>
<td>
<asp:Button ID="inserisci" Runat="server" Text=">>" onClick="trasferisci" />
<asp:Button ID="togli" Runat="server" Text="<<" onClick="trasferisci" />
</td>
<td>
<asp:ListBox ID="lista2" Runat="server" SelectionMode="Single">
</asp:ListBox>
</td>
</tr>
</table>
</form>
</body>
</HTML>