<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true" RenderMode="Inline" UpdateMode="Conditional">
<ContentTemplate>
下拉框 一:<asp:DropDownList ID="droprivince" AutoPostBack="true" OnTextChanged="dd_province_TextChanged" Style="width: 100%;" class="form-control" runat="server"></asp:DropDownList>
下拉框 二:<asp:DropDownList ID="drocity" Style="width: 100%;" class="form-control" runat="server" AutoPostBack="true" OnTextChanged="dd_coty_TextChanged"></asp:DropDownList>
下拉框 三:<asp:DropDownList ID="droarea" Style="width: 100%;" class="form-control" runat="server"></asp:DropDownList>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true" RenderMode="Inline" UpdateMode="Conditional">
<ContentTemplate>
下拉框 一:<asp:DropDownList ID="droprivince" AutoPostBack="true" OnTextChanged="dd_province_TextChanged" Style="width: 100%;" class="form-control" runat="server"></asp:DropDownList>
下拉框 二:<asp:DropDownList ID="drocity" Style="width: 100%;" class="form-control" runat="server" AutoPostBack="true" OnTextChanged="dd_coty_TextChanged"></asp:DropDownList>
下拉框 三:<asp:DropDownList ID="droarea" Style="width: 100%;" class="form-control" runat="server"></asp:DropDownList>
</ContentTemplate>
(要想一些样式不变化就加上这些)
<Triggers>
<asp:AsyncPostBackTrigger ControlID="droprivince" EventName="TextChanged" />
<asp:AsyncPostBackTrigger ControlID="drocity" EventName="TextChanged" />
<asp:AsyncPostBackTrigger ControlID="droarea" EventName="TextChanged" />
</asp:UpdatePanel>
后台就按照触发事件,没有什么变化
本文展示了一个使用ASP.NET AJAX技术实现的级联下拉框示例,通过UpdatePanel和AsyncPostBackTrigger控制下拉框之间的联动,使得在用户选择一项后可以异步加载相关选项。
1226

被折叠的 条评论
为什么被折叠?



