Questions tagged «selectedindexchanged»

7
DropDownList的SelectedIndexChanged事件未触发
我的网页中有一个DropDownList对象。当我单击它并选择一个不同的值时,即使我有连接到该SelectedIndexChanged事件的功能,也没有任何反应。 首先,实际对象的HTML代码: <asp:DropDownList ID="logList" runat="server" onselectedindexchanged="itemSelected"> </asp:DropDownList> 这就是那个功能itemSelected: protected void itemSelected(object sender, EventArgs e) { Response.Write("Getting clicked; " + sender.GetType().ToString()); FileInfo selectedfile; Response.Write("<script>alert('Hello')</script>"); foreach (FileInfo file in logs) { if (file.Name == logList.Items[logList.SelectedIndex].Text) { Response.Write("<script>alert('Hello')</script>"); } } } 没有任何响应出现,并且该JavaScript部分从未运行。我已经在最新的3.6版Firefox和Internet Explorer 8上进行了尝试。这是通过Windows Server 2003 R2计算机提供的,该计算机运行带有.NET Framework版本4的ASP.NET。
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.