DropDownList不会在SelectedIndexChanged上回发 [英] DropDownList doesn't postback on SelectedIndexChanged

查看:182
本文介绍了DropDownList不会在SelectedIndexChanged上回发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个ASP.Net webform,其中有一些DropDownList控件。然后,用户在下拉列表中更改所选项目,ASP.Net似乎不处理SelectedIndexChanged事件,直到表单通过提交按钮单击提交。
如何让我的下拉列表立即处理SelectedIndexChanged?



P.S。这是一个经典的问题,我已经回答了太多次,但似乎没有人在stackoverflow之前问过。

解决方案

设置< a href =http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listcontrol.autopostback(VS.71).aspx =noreferrer>自动回覆属性为true将导致其在选择更改时进行回发。请注意,这需要启用javascript。


I'm writing an ASP.Net webform with some DropDownList controls on it. Then user changes selected item in one of dropdowns, ASP.Net doesn't seem to handle SelectedIndexChanged event until form is submitted with a 'Submit' button click. How do I make my dropdowns handle SelectedIndexChanged instantly?

P.S. It's a classic question I have answered too many times, but it seems no one asked it before on stackoverflow.

解决方案

Setting the AutoPostback property to true will cause it to postback when the selection is changed. Please note that this requires javascript to be enabled.

这篇关于DropDownList不会在SelectedIndexChanged上回发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆