標記: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