更新UpdatePanel外部的控件

所以我有一个UserControl,上面有一些级联的DropDownLists。从列表1中选择将启用列表2,而列表2又将启用列表3。在所有三个列表中进行选择后,您可以进入下一页

DropDownLists都在UpdatePanel中。但是“下一页”按钮在UpdatePanel之外。应禁用该按钮,直到所有三个列表都有一个选择,然后应再次启用该按钮。但是,由于该按钮位于更新面板之外,因此在我进行选择时它不会更新。(编辑:“下一页”按钮位于也包含用户控件的页面上

我知道一种解决方法:

var scriptManager=scriptManager.GetCurrent(this.Page);
scriptManager.RegisterPostBackControl(DropDownList 1);
scriptManager.RegisterPostBackControl(dropDownList2);
scriptManager.RegisterPostBackControl(DropDownList 3);

这可以确保在更改任何下拉列表时回发,以便按钮可以更新。但是如果我这样做,我可能会通过首先去掉UpdatePanel来简化

是否有另一种方法,通过一些聪明的JavaScript或其他东西,我可以在UpdatePanel之外更新控件,而不必放弃Ajax

在“下一步”按钮周围放置一个UpdatePanel,并为每个下拉列表创建一个触发器,以便触发异步回发。例:

<触发器>
<asp:AsyncPostBackTrigger ControlID=“DropDownList 1”/>
<asp:AsyncPostBackTrigger ControlID=“DropDownList 2”/>
<asp:AsyncPostBackTrigger ControlID=“DropDownList 3”/>
&lt/触发器>

发表评论