Matt
Matt

Reputation: 349

Values set inside dropdowns selectedindexchanged not showing in modalpopupextender

I am using a modal popup that contains a dropdown box. When the dropdown is changed I'm trying to retrieve data and assign it labels also within the modal. I observe the label values being set in the debugger but they do not show in the modal.

Modal/Panel Code:

<asp:Panel ID="pnlUpdate" runat="server" CssClass="modalPopup">
     <div>   
          <asp:UpdatePanel runat="server" ID="upSubnetUpdate" UpdateMode="Conditional">
             <ContentTemplate>
                  <asp:Label runat="server" ID="pnlLblSubnet" CssClass="searchLabel">Subnet:</asp:Label>
                  <asp:DropDownList runat="server" ID="ddlSubnet" OnSelectedIndexChanged="ddlSubnet_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList><br />
             </ContentTemplate>
         </asp:UpdatePanel> 
     </div>
     <div>
         <asp:Label runat="server" ID="lblIPStartUpdate"></asp:Label>
         <asp:Label runat="server" ID="lblIPEndUpdate"></asp:Label>
         <asp:Label runat="server" ID="lblGatewayUpdate"></asp:Label>
         <asp:Label runat="server" ID="lblSubnetMaskUpdate"></asp:Label>
    </div>
</asp:Panel>

Dropdown Code

protected void ddlSubnet_SelectedIndexChanged(object sender, EventArgs e)
    {
        SubnetInfo si = GetSubnetInfo(ddlSubnet.SelectedItem.Text);
        lblIPStartUpdate.Text = si.IP_Start;
        lblIPEndUpdate.Text = si.IP_End;
        lblGatewayUpdate.Text = si.Gateway;
        lblSubnetMaskUpdate.Text = si.Subnet_Mask;
    }

I'm not sure if this is a page lifecycle issue or a limitation of the modal popup.

Thanks for the help!

Upvotes: 1

Views: 612

Answers (1)

James Johnson
James Johnson

Reputation: 46047

You need to put the DropDown and the labels in an UpdatePanel. The dropdown is in an UpdatePanel, but it cannot update the labels if they're not in an UpdatePanel too.

Upvotes: 1

Related Questions