UpdatePanel中的DropDownList为什么怎么选得到的都是第一个值?

来源:百度知道 编辑:UC知道 时间:2024/06/24 15:37:33
UpdatePanel中有2个DropDownList:
<asp:UpdatePanel ID="updp1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropDownList1_Changed">
<asp:ListItem Text="省" Selected="True"></asp:ListItem>
<asp:ListItem Text="市" Selected="false"></asp:ListItem>
<asp:ListItem Text="县" Selected="false"></asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="DropDownList2" runat="server"></asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>

DropDownList1控制DropDownList2的可用与不可用:
protected void DropDownList1_Changed(object sender, EventArgs

测试你的代码,未出现你所描述的情况
///////////////////myHtml

<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DropDownList1_Changed">
<asp:ListItem Text="省" Selected="True"></asp:ListItem>
<asp:ListItem Text="市" Selected="false"></asp:ListItem>
<asp:ListItem Text="县" Selected="false"></asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="DropDownList2" runat="server"