标记:Asp.NET的DropDownList SelectedItem.Value不改变
<div style="float:left;margin-top:15px;width:80px">
<asp:DropDownList ID="MyList" runat="server" Width="100px"></asp:DropDownList>
</div>
代码:
// clear vehicles list
MyList.Items.Clear();
// add 'all' option
MyList.Items.Add(new ListItem("ALL", "0"));
// add assets
foreach (CustomClass item in items)
MyList.Items.Add(new ListItem(item.Name, item.ID.ToString()));
没有事件触发了的SelectedIndexChanged因为它是没有必要的。
当我点击回发按钮时,selecteditem的值仍然是DropDownList中第一项的值。我错过了什么?
备注 请停止回复和编辑帖子。我们可能会保留它,因为它已经被回答了。
dammit。我没有注意到这一点。谢谢 – Bahamut 2012-04-27 04:05:38