所以我有一个UserControl
带有一些级联DropDownList
的 s 。从列表 1 中选择会启用列表 2,而后者又会启用列表 3。在所有三个列表中做出选择后,您可以转到下一页。
DropDownList
s 都在一个UpdatePanel
. 但是“下一页”按钮在UpdatePanel
. 应该禁用该按钮,直到所有三个列表都有选择,然后应该再次启用它。但由于该按钮位于 之外UpdatePanel
,因此在我进行选择时它不会更新。(编辑:“下一页”按钮位于还包含的页面上UserControl
。)
我知道解决这个问题的一种方法:
var scriptManager = ScriptManager.GetCurrent(this.Page);
scriptManager.RegisterPostBackControl(dropDownList1);
scriptManager.RegisterPostBackControl(dropDownList2);
scriptManager.RegisterPostBackControl(dropDownList3);
这样可以确保在更改任何下拉列表时进行回发,以便按钮可以更新。但是如果我这样做,我可能会通过首先摆脱 来简化UpdatePanel
。
有没有另一种方法,通过一些聪明的 JavaScript 或其他东西,我可以在UpdatePanel
不放弃 Ajax 的情况下更新控件之外的控件?