我尝试在没有页面刷新的情况下填充下拉城市和区域。所以我在Updatepanel和Script Manager中使用。代码在
下面 <asp:ScriptManager ID="script1" runat="server" EnablePartialRendering="true"></asp:ScriptManager>
<div class="form-list wow fadeInRight" data-wow-delay="0.5s">
<ul class="navmain">
<li>
<asp:UpdatePanel ID="upd1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
<ContentTemplate>
<!--<asp:DropDownList ID="drp_city" runat="server" CssClass="drp" OnSelectedIndexChanged="drp_city_SelectedIndexChanged" AutoPostBack="true" ></asp:DropDownList>-->
<asp:DropDownList ID="drp_city1" runat="server" CssClass="drp" OnSelectedIndexChanged="drp_city_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>
<asp:HiddenField ID="hfCustomerId" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</li>
<li>
<asp:UpdatePanel ID="upd2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:DropDownList ID="drp_area" runat="server" CssClass="drp" AutoPostBack="true"></asp:DropDownList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="drp_city1" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
</li>
<li>
<asp:UpdatePanel ID="upd3" runat="server">
<ContentTemplate>
<asp:DropDownList ID="drp_cuisine" runat="server" CssClass="drp"></asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
</li>
</ul>
<asp:Button OnClick="btn_search1" runat="server" CssClass="btn_search" />
</div>
我无法找到错误。页面没有刷新,但区域下拉列表没有填充。