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