T
TJS
can someone tell me why the selected item won't reflect user change in this
little droplist example
<%@ Page Language="VB" %>
<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
mydropdown.Items.clear
mydropdown.Items.Add( New ListItem( "alpha", "alpha" ))
mydropdown.Items.Add( New ListItem( "beta", "beta" ))
mydropdown.Items.Add( New ListItem( "gamma", "gamma" ))
End Sub
Sub Select_Click(ByVal sender As Object, ByVal e As EventArgs)
Messagex.text &= " selected = "
Messagex.text &= mydropdown.SelectedIndex
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<table cellspacing="0" cellpadding="0" width="50%" border="0">
<tbody>
<tr valign="center">
<td align="left" width="100%">
<span>Select :</span>
</td>
<td align="left" width="100%">
<aspropDownList id="mydropdown" runat="server"
enableviewstate="true"></aspropDownList>
</td>
<td align="left" width="100%">
<asp:Button id="btnSelect" onclick="Select_Click"
runat="server" CausesValidation="False" Text="GO"></asp:Button>
</td>
</tr>
<tr valign="center">
<td align="left" width="100%">
<br />
<asp:Label id="Messagex" runat="server"
enableviewstate="true" forecolor="red" width="80%"></asp:Label></td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
little droplist example
<%@ Page Language="VB" %>
<script runat="server">
Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
mydropdown.Items.clear
mydropdown.Items.Add( New ListItem( "alpha", "alpha" ))
mydropdown.Items.Add( New ListItem( "beta", "beta" ))
mydropdown.Items.Add( New ListItem( "gamma", "gamma" ))
End Sub
Sub Select_Click(ByVal sender As Object, ByVal e As EventArgs)
Messagex.text &= " selected = "
Messagex.text &= mydropdown.SelectedIndex
End Sub
</script>
<html>
<head>
</head>
<body>
<form runat="server">
<table cellspacing="0" cellpadding="0" width="50%" border="0">
<tbody>
<tr valign="center">
<td align="left" width="100%">
<span>Select :</span>
</td>
<td align="left" width="100%">
<aspropDownList id="mydropdown" runat="server"
enableviewstate="true"></aspropDownList>
</td>
<td align="left" width="100%">
<asp:Button id="btnSelect" onclick="Select_Click"
runat="server" CausesValidation="False" Text="GO"></asp:Button>
</td>
</tr>
<tr valign="center">
<td align="left" width="100%">
<br />
<asp:Label id="Messagex" runat="server"
enableviewstate="true" forecolor="red" width="80%"></asp:Label></td>
</tr>
</tbody>
</table>
</form>
</body>
</html>