有没有一种方法可以在下拉列表下拉之前,当用户点击它时填充它?我想也许使用CascadingDropDown可以工作,但我根本不能让它工作。
发布于 2013-01-29 02:20:43
您是否考虑过只使用UpdatePanel并将DropDownList放在它上面?
然后,只需实现DropDownList的OnSelectedIndexChanged事件,使其重新加载下一个DropDownList。如果你不想使用CascadingDropDown,这是最简单的方法,它让你很好地了解它们是如何捆绑在一起的。只需注意您的ViewState,如果不需要,则将其禁用。
下面是asp.net标记的一个示例:
<asp:DropDownList ID="yourFirstDropDownList" runat="server"
OnSelectedIndexChanged="yourFirstDropDownList_OnSelectedIndexChanged" />
<asp:UpdatePanel ID="yourUpdatePanel" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="yourFirstDropDownList"
EventName="SelectedIndexChanged">
</Triggers>
<ContentTemplate>
<asp:DropDownList ID="yourSecondDropDownList" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>https://stackoverflow.com/questions/14567237
复制相似问题