This is a migrated thread and some comments may be shown as answers.

how to hide the the dropdown when I delete the text of the RdcomboBox On the page

1 Answer 83 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Fang Fang
Top achievements
Rank 1
Fang Fang asked on 30 Mar 2009, 09:51 AM
Hello:
    I user the control like this:

    <telerik:RadComboBox DropDownWidth="0" ID="comCity" runat="server" Width="204px" AllowCustomText="true"
                         Filter="StartsWith" EnableLoadOnDemand="true" EnableItemCaching="true" OnItemsRequested="comCity_ItemsRequested"
                         ShowToggleImage="False" ShowWhileLoading="False" Skin="WebBlue" OnClientDropDownOpening="OnClientDropDownOpeningHandler">
                         <CollapseAnimation Duration="200" Type="OutQuint" />
                     </telerik:RadComboBox>

and in the function comCity_ItemsRequested, when the text is empty, the items will be clear.

and my problem is, after the items cleared, a blank line dropdown will be displayed, how to make it disappear?

1 Answer, 1 is accepted

Sort by
0
Fang Fang
Top achievements
Rank 1
answered on 31 Mar 2009, 03:17 AM
I fixed it by myself.
Like this:

<telerik:RadComboBox DropDownWidth="0" ID="comCity" runat="server" Width="204px" AllowCustomText="true"
                         Filter="StartsWith" EnableLoadOnDemand="true" EnableItemCaching="true" OnItemsRequested="comCity_ItemsRequested"
                         ShowToggleImage="False" ShowWhileLoading="False" Skin="WebBlue" OnClientItemsRequested="OnClientItemsRequested" ShowDropDownOnTextboxClick="false">
                         <CollapseAnimation Duration="200" Type="OutQuint" />
                     </telerik:RadComboBox>

And add a script function:
<script>
function OnClientItemsRequested(sender, eventArgs)
{
    if(sender._itemData==null){
        sender.hideDropDown();
    }
}
</script>
Tags
ComboBox
Asked by
Fang Fang
Top achievements
Rank 1
Answers by
Fang Fang
Top achievements
Rank 1
Share this question
or