我正在处理onSelectIndexChanged
事件。当 DropDownList 选择更改时引发事件。问题是 DropDownList 仍然返回SelectedValue
and的旧值SelectedIndex
。我究竟做错了什么?
这是 aspx 文件中的 DropDownList 定义:
<div style="margin: 0px; padding: 0px 1em 0px 0px;">
<span style="margin: 0px; padding: 0px; vertical-align: top;">Route:</span>
<asp:DropDownList id="Select1" runat="server" onselectedindexchanged="index_changed" AutoPostBack="true">
</asp:DropDownList>
<asp:Literal ID="Literal1" runat="server"></asp:Literal>
</div>
这是 DropDownListOnSelectedIndexChanged
事件处理程序:
protected void index_changed(object sender, EventArgs e)
{
decimal d = Convert.ToDecimal( Select1.SelectedValue );
Literal1.Text = d.ToString();
}