<asp:DropDownList ID="DropDownList1" runat="server"> <asp:ListItem>select....</asp:ListItem> <asp:ListItem Value="10">a</asp:ListItem> <asp:ListItem Value="12">b</asp:ListItem> Response.write(this.DropDownList1.SelectedValue)為什么是select....呀,他不是空嗎?
2 回答

幕布斯7119047
TA貢獻(xiàn)1794條經(jīng)驗(yàn) 獲得超8個(gè)贊
因?yàn)镈ropDownList 默認(rèn)把第一個(gè)選項(xiàng)作為選中項(xiàng),但是第一個(gè)中沒有value值,.net自動(dòng)把text值作為SelectedValue,同樣的,當(dāng)只有value而沒有text時(shí),它也會(huì)把value值作為text顯示在選項(xiàng)中!完畢。
- 2 回答
- 0 關(guān)注
- 409 瀏覽
添加回答
舉報(bào)
0/150
提交
取消