tomouse
Technical User
- Aug 30, 2010
- 50
I have Ajax cascading dropdowns working well - I select a country and it returns the cities for that country, I select a city and it returns the hotels for that city. However, now I have a request that if no hotels are returned for the city, then the hotel dropdown (dplHotel) should be hidden and a text box (txtHotelManual) should be displayed instead.
The work for populating the dropdowns is done within a webservice - the webservice returns a list of CascadingDropDownNameValues. But none of this seems to involve the code behind. I somehow need to check whether any values have been returned and if not, I hide the dropdown and show the textbox. My code is here:
I tried checking it with javascript but couldn't get it to work. Does anyone have any bright ideas/suggestions? Thanks,
Tom
The work for populating the dropdowns is done within a webservice - the webservice returns a list of CascadingDropDownNameValues. But none of this seems to involve the code behind. I somehow need to check whether any values have been returned and if not, I hide the dropdown and show the textbox. My code is here:
Code:
<div class="divForm meiaColuna" style="float: left; clear: none;">
<asp:Label ID="Label2" runat="server" Text="<%$ Resources:LocalizedText, city %>" />:
<asp:DropDownList ID="dplHotelCidade" runat="server" Width="165" onChange="PersistControl(this,'hidIDCidade');ClearControl(this,'hidIDHotel');" />
<asp:PlaceHolder ID="phCidade" runat="server" Visible="false">
<img id="imbModalCidade" class="IconePlus" src="img/btn_mais.gif" onclick="void(abreDialog('AdminCidade')); scroll(0,0);" />
</asp:PlaceHolder>
</div>
<div class="divForm" id="divHotel" style="clear: none;">
*<asp:Label ID="Label3" runat="server" Text="<%$ Resources:LocalizedText, hotelname %>" />:
<asp:DropDownList ID="dplHotel" runat="server" onChange="PersistControl(this,'hidIDHotel');" Width="220" />
<asp:TextBox ID="txtHotelManual" runat="server" Visible="false" />
<asp:PlaceHolder ID="phHotel" runat="server" Visible="false">
<img id="imbModalHotel" class="IconePlus" src="img/btn_mais.gif" onclick="void(abreDialog('AdminHotel')); scroll(0,0);" />
</asp:PlaceHolder>
</div>
<asp:CascadingDropDown ID="ccddHotelPais" runat="server" Category="Pais" PromptText="<%$ Resources:LocalizedText, CCDDSelectCountry %>" ServiceMethod="GetPaises"
ServicePath="~/wsDropDowns.asmx" TargetControlID="dplHotelPais" UseContextKey="true" />
<asp:CascadingDropDown ID="ccddHotelCidade" runat="server" Category="Cidade" PromptText="<%$ Resources:LocalizedText, CCDDSelectCity %>" ServiceMethod="GetCidades"
ServicePath="~/wsDropDowns.asmx" TargetControlID="dplHotelCidade" ParentControlID="dplHotelPais" />
<asp:CascadingDropDown ID="ccddHotelHotel" runat="server" Category="Hotel" PromptText="<%$ Resources:LocalizedText, CCDDSelectHotel %>" ServiceMethod="GetHoteis"
ServicePath="~/wsDropDowns.asmx" TargetControlID="dplHotel" ParentControlID="dplHotelCidade" />
Tom