Updatepanel和回发问题

时间:2012-07-06 18:52:07

标签: c# asp.net updatepanel postback

我有2个ddl,ddlCountry和ddlState,在选择ddlCountry时,ddlState IS根据所选国家/地区更新...当我选择ddlState时,ddlState中的选定项目未被标记为已选中,因此我可以'得到所选的值。

以下是代码:

<asp:DropDownList 
    ID="ddlReceiverCountry" 
    runat="server" 
    CssClass="textBox" 
    OnSelectedIndexChanged="ddlReceiverCountry_SelectedIndexChanged" 
    AutoPostBack="true" >
</asp:DropDownList>
    <br />
<asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional"  >
    <ContentTemplate>
        <asp:Label ID="lblReceiverState" runat="server" Text="State" CssClass="newReceiverlabel">
        </asp:Label>
        <asp:DropDownList 
            ID="ddlReceiverState" 
            runat="server" 
            CssClass="textBox" OnSelectedIndexChanged="ddlReceiverState_SelectedIndexChanged">     
        </asp:DropDownList>
    </ContentTemplate>
    <Triggers>
        <asp:PostBackTrigger ControlID="ddlReceiverState" />
        <asp:AsyncPostBackTrigger ControlID="ddlReceiverCountry" EventName="SelectedIndexChanged"   />
    </Triggers>
</asp:UpdatePanel>

0 个答案:

没有答案