VB.NET - dropdownlists in nested update panels are not working properly, how do I fix?

Asked By Brandon Schave on 16-Aug-13 01:28 PM
I have a update panel control for a multiview (tabs) and within a view of the multiview I have a search page that includes another update panel with dropdownlists. These dropdownlists are tiered (select item in ddl 1 and ddl2 populates, etc.) and what is happening is that when an item in dropdownlist2 is selected, the onselectedindexchange event first for the first and second dropdownlist. Also, the selected value for ddl2 is blank, it's like the control was never selected. What can I do to fix the issue? By the way I am on asp.net 2.0 and code is attached.



<ajax:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
      <ContentTemplate>
      <asp:HiddenField ID="hTabid" runat="server" Value="" />
        <table runat="server" id="tblMainContent" cellspacing="0" cellpadding="0" style="width:630px;height:auto;margin-top:-10px;">
          <tr>
            <td id="Td1" runat="server" colspan="1" style="width: 5px; height: 38px" valign="top"></td>
            <td align="left" style="width:590px; height: 38px; vertical-align: bottom;">
              <asp:Button ID="Button2" runat="server" Text="CURRENT AUCTIONS" Width="210px" CssClass="home_tab" meta:resourcekey="Menu1AuctionResource1" OnClick="Button2_Click" CausesValidation="False" UseSubmitBehavior="False" />
              <asp:Button ID="Button1" runat="server" Text="Sellers" Width="90px" meta:resourcekey="Menu1EquipmentResource1" CssClass="home_tab" OnClick="Button1_Click" CausesValidation="False" UseSubmitBehavior="False" />
              <asp:Button ID="Button3" runat="server" Text="Equipment" Width="100px" meta:resourcekey="Menu1LocationsResource1" CssClass="home_tab" OnClick="Button3_Click" CausesValidation="False" UseSubmitBehavior="False" />
              <asp:Button ID="Button4" runat="server" Text="Locations" Width="100px" CssClass="home_tab" meta:resourcekey="Menu1ConsignorsResource1" OnClick="Button4_Click" CausesValidation="False" UseSubmitBehavior="False" />
            </td>
            <td align="left"> </td>
          </tr>
          <tr id="Tr1" runat="server">
            <td id="Td2" runat="server" style="width:5px;" valign="top" colspan="1">
            </td>
            <td id="Td3" runat="server" style="width:630px;border-left:solid 1px #000" valign="top" colspan="2">
                 
              <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
                <asp:View ID="View1" runat="server">
                  <table style="width: 500px">
                    <tr>         
                      <td colspan="3"> </td>
                    </tr>
                    <tr>
                      <td style="width: 15px">
                         </td>
                      <td style="width: 275px" class="bold">
                        <asp:Label ID="lblKeywordSearch" runat="server" Text="Keyword Search:"></asp:Label></td>
                      <td style="width: 185px">
                        <asp:TextBox ID="txtKeywords" runat="server"></asp:TextBox></td>
                    </tr>
                    <tr>
                      <td style="width: 15px"
                      </td>
                      <td style="width: 275px" class="bold">
                        <asp:Label ID="lblCategory" runat="server" Text="Category:"></asp:Label>
                      </td>
                      <td style="width: 185px">
                        <asp:DropDownList ID="ddlCategory" runat="server">
                        </asp:DropDownList></td>
                    </tr>      
                    <!--Locations in detail-->
                     
                    <tr><td colspan="3"><br /><asp:Label ID="lblNote" CssClass="small_text_color" runat="server" Text="Please select country, then state and city to filter by location."></asp:Label><br /> </td>    </tr>
                        <tr>
                              <td class="bold" style="width: 15px">
                              </td>
                              <td style="width: 200px" class="bold">
                                <asp:Label ID="lblCountries" runat="server" Text="Countries:"></asp:Label></td>
                              <td style="width: 158px">
                                <asp:DropDownList ID="ddlCountries" runat="server" AutoPostBack="true">
                                </asp:DropDownList></td>
                            </tr>
                            <tr>
                              <td class="bold" style="width: 15px">
                              </td>
                              <td style="width: 200px" class="bold">
                                <asp:Label ID="lblStateProvince" runat="server" Text="State/Province:"></asp:Label></td>
                              <td style="width: 158px">
                                <asp:DropDownList ID="ddlStates" runat="server" AutoPostBack="true">
                                </asp:DropDownList>
                              </td>
                            </tr>
                     
                    <ajax:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
                      <Triggers>
                        <ajax:AsyncPostBackTrigger ControlID="ddlCountries" EventName="SelectedIndexChanged" />
                        <ajax:AsyncPostBackTrigger ControlID="ddlStates" EventName="SelectedIndexChanged" />
                      </Triggers>
                      <ContentTemplate>
                         
                            <tr>
                              <td class="bold" style="width: 15px">
                              </td>
                              <td style="width: 200px" class="bold">
                                <asp:Label ID="lblCityLocation" runat="server" Text="City/Location:"></asp:Label></td>
                              <td style="width: 158px">
                                <asp:DropDownList ID="ddlCity" runat="server">
                                </asp:DropDownList></td>
                            </tr>
                      </ContentTemplate>
                      </ajax:UpdatePanel>
                            <!--Locations in detail-->
                        <tr>
                          <td style="width: 15px"
                          </td>
                          <td style="width: 275px" class="bold">
                            <asp:Label ID="lblConsignors" runat="server" Text="Consignors:"></asp:Label></td>
                          <td style="width: 185px">
                            <asp:DropDownList ID="ddlConsignors" runat="server">
                            </asp:DropDownList></td>
                        </tr>
                        <tr>
                          <td style="width: 15px"
                          </td>
                          <td style="width: 275px" class="bold">
                            <asp:Label ID="lblLotID" runat="server" Text="Lot ID:"></asp:Label></td>
                          <td style="width: 185px">
                            <asp:TextBox ID="txtLotID" runat="server"></asp:TextBox></td>
                        </tr>
                        <tr>
                          <td style="width: 15px"
                          </td>
                          <td style="width: 275px" class="bold">
                            <asp:Label ID="lblAuction" runat="server" Text="Auction:"></asp:Label></td>
                          <td style="width: 185px">
                            <asp:DropDownList ID="ddlAuction" runat="server">           
                            </asp:DropDownList></td>
                        </tr>
                        <tr>
                          <td style="width: 15px"
                          </td>
                          <td style="width: 275px" class="bold">
                            <asp:Label ID="lblEventType" runat="server" Text="Event Type:"></asp:Label></td>
                          <td style="width: 185px"><asp:DropDownList ID="ddlAucType" runat="server">
                            <asp:ListItem Value="0" meta:resourcekey="ddiAllEventsResource1">All Events</asp:ListItem>
                            <asp:ListItem Value="1" meta:resourcekey="ddiAuctionResource1">Auction</asp:ListItem>
                            <asp:ListItem Value="2" meta:resourcekey="ddiPrivateSaleResource1">Private Sale</asp:ListItem>
                          </asp:DropDownList></td>
                        </tr>
                        <tr>         
                          <td colspan="3"> </td>
                        </tr>
                        <tr>
                          <td style="width: 15px"
                          </td>
                          <td style="width: 275px">
                          </td>
                          <td style="width: 185px">
                            <asp:Button ID="btnSearch" runat="server" Text="" CssClass="adv_search_btn" /></td>
                        </tr>
                        <tr>         
                          <td colspan="3"> </td>
                        </tr>
                      </table>
                </div>
                </asp:View>
                <asp:View ID="View2" runat="server">
                  <table style="width:610px;" cellspacing="0" cellpadding="0" class="home_tab_container">
                    <tr>
                      <td>
                        <asp:DataList runat="server" ShowFooter="False" ShowHeader="false" CellPadding="0"
                           Width="600px" ID="dlSellers" RepeatColumns="3" RepeatLayout="Table" EnableViewState="true">
                          <ItemTemplate>
                            <div style="padding:10px 0 10px 10px;">
                              <a href='BrowseLots.aspx?concode=<%# DataBinder.Eval(Container.DataItem, "consignor_code") %>'>
                                <asp:Image ID="imgSeller" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "logo_path") %>' AlternateText='<%# DataBinder.Eval(Container.DataItem, "alttext") %>' runat="server" />
                              </a>
                            </div>
                          </ItemTemplate>
                        </asp:DataList>
                      </td>
                    </tr>
                  </table>
                </asp:View>
                <asp:View ID="View3" runat="server">
                  <div style="height:100%;width:610px;border-top:solid 1px #000;border-right:solid 1px #000;border-bottom:solid 1px #000;padding:10px 0 10px 5px;">
                    <asp:DataList ID="dl_equipment" runat="server" Width="610px" RepeatColumns="2" RepeatLayout="Table" OnItemDataBound="dl_equipment_ItemDataBound">
                      <ItemTemplate>
                        <div style="width:300px;margin-top:18px;line-height:18px;">
                          <asp:HiddenField ID="hfCatID" runat="server" Value='<%# Eval("categoryid") %>' />
                          <span id="showhidelinks" class="bold" runat="server" style="width:15px;"></span>
                          <a class="small_text, bold" href='BrowseLots.aspx?categoryid=<%#Eval("categoryid")%>&order=8&pageindex=1&numrows=50'>
                            <%#Eval("categoryname")%> (<%#Eval("categorycount")%>)
                          </a>
                          <div id="childlist" runat="server" style="width:300px;">
                            <asp:DataList ID="dlstChildCategory" runat="server" SkinID="dlstDefault" RepeatColumns="1" RepeatDirection="Vertical" RepeatLayout="table" Width="261px">
                              <ItemStyle Width="300px" />
                              <ItemTemplate>
                                <div id="childcat_div" style="margin:0px 0px 0px 15px; width:300px;line-height:14px;">
                                  <span class="bold">
                                    <a class="small_text" href='BrowseLots.aspx?categoryid=<%#Eval("childid")%>&order=8&pageindex=1&numrows=50'>
                                      <%#Eval("childname")%> (<%#Eval("childcount")%>)
                                    </a>
                                  </span>
                                </div>
                              </ItemTemplate>
                            </asp:DataList>
                          </div>
                        </div>
                      </ItemTemplate>
                    </asp:DataList>
                  </div>
                </asp:View>
                <asp:View ID="View4" runat="server">
                  <table style="width: 610px" cellspacing="0" cellpadding="0" class="home_tab_container">
                      <tr id="Tr3" runat="server" style="background-color:#4A92C4;color:#fff;padding: 5px 0 5px 0;font-size:12px;">
                        <th id="Td5" runat="server" align="left" style="width: 290px; padding:8px 0 8px 5px;border-bottom: solid 1px #000;" valign="top">
                          <asp:Label ID="lblUSA" runat="server" CssClass="medium_text" Text="USA:" meta:resourcekey="lblUSAResource1"></asp:Label>
                          <asp:HyperLink runat="server" NavigateUrl="~/BrowseLots.aspx?location=usa"
                            ID="hEquipmentLocationUSA" meta:resourcekey="hEquipmentLocationUSAResource1"
                            Text="(All)"></asp:HyperLink></th>
                         <th align="left" style="width: 15px;border-bottom: solid 1px #000;" valign="top">  
                        </th>                              
                        <th align="left" valign="top" style="width: 290px; padding:8px 0 8px 5px;border-bottom: solid 1px #000;">
                          <asp:Label runat="server" Text="International:" CssClass="medium_text" ID="lblOther"
                            meta:resourcekey="lblOtherResource1"></asp:Label>
                          <asp:HyperLink runat="server" NavigateUrl="~/BrowseLots.aspx?location=intl"
                            ID="hEquipmentLocationIntl" meta:resourcekey="hEquipmentLocationIntlResource1"
                            Text="(All)"></asp:HyperLink></th>
                      </tr>
                      <tr id="Tr4" runat="server">
                        <td id="Td6" runat="server" align="left" colspan="3" style="height: 0px;">
                        </td>
                      </tr>
                      <tr runat="server" id="trlocations" style="padding-bottom:10px;">
                        <td id="tdUSA" runat="server" align="left" valign="top" style="padding-left:10px;">
                          <asp:DataList runat="server" ShowFooter="False" ShowHeader="false" CellPadding="0" CellSpacing="0"
                             Width="290px" ID="dlUSA" RepeatColumns="3" RepeatLayout="Table" EnableViewState="true">
                            <ItemTemplate>
                              <div style="width:95px;padding: 3px 0 3px 0;line-height:24px;">
                                <a href='BrowseLots.aspx?location=<%# Eval("Key") %>'>
                                  <%# Eval("Key") %>
                                </a>
                              </div>
                            </ItemTemplate>
                          </asp:DataList></td>
                        <td align="left" style="width: 15px;border-left:solid 1px #000;" valign="top">  
                        </td>
                        <td id="tdOther" align="left" valign="top" runat="server">
                          <asp:DataList runat="server" ShowFooter="False" ShowHeader="False" CellPadding="0"
                             Width="270px" CssClass="dl_container" ID="dlIntl" RepeatColumns="2" RepeatLayout="Table" EnableViewState="true">
                            <ItemTemplate>
                              <div style="width:100px;padding: 3px 0 3px 0;line-height:24px;">
                                <a href='BrowseLots.aspx?location=<%# Eval("Key") %>'>
                                  <%#Eval("Key")%>
                                </a>
                              </div>
                            </ItemTemplate>
                          </asp:DataList></td>
                      </tr>
                  </table>
                </asp:View>
              </asp:MultiView>
              </td>
          </tr>
        </table>
      </ContentTemplate>
    </ajax:UpdatePanel>