Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Combobox > Hide Dropdown in Combobox
RadControls for ASP.NET are no longer supported (see this page for reference). In case you have inquiries about the Telerik ASP.NET AJAX controls, post them in the pertinent ASP.NET AJAX forums.

Not answered Hide Dropdown in Combobox

Feed from this thread
  • mkk avatar

    Posted on Apr 28, 2011 (permalink)

    Hi All,

    I am using telerik ComboBox, with label enabled, Now i am in a situation where i need to hide dropdown and just display a friendly message in place of the dropdown, i still need to have label of the filter all the time.

    What i have tried is using DropDownCssClass, but it is not able to hide complete dropdown.

    Is there any way to hide complete dropdown and display friendly message.

  • mkk avatar

    Posted on Apr 28, 2011 (permalink)

    I also Tried using Empty message field, but i don't figure out a way to hide drop down and just make the empty message look like a label. 

  • Posted on Apr 29, 2011 (permalink)

    Hello,

    I am not quite sure about your scenario.

    If you want to hide the dropdown arrow set  ShowToggleImage property to false.
    RadComboBox1.ShowToggleImage = false;

    Or if you want to prevent the DropDown from opening, then you can use OnClientDropDownOpening client-side event which occurs before the drop-down list opens and cancel the event from there
    .
    aspx:
    <telerik:RadComboBox ID="RadComboBox1" runat="server" OnClientDropDownOpening="OnClientDropDownOpening"  ShowToggleImage="false"  AllowCustomText="true">
    </telerik:RadComboBox>

    Javascript:
    function OnClientDropDownOpening(Sender, args)
      {
          args.set_cancel(true);
      }

    Thanks,
    Shinu.

  • mkk avatar

    Posted on Apr 29, 2011 (permalink)

    Hi Shinu,

    Thanks for ur reply, but what i am trying to do here is 
    when there are no values in the filter i need to hide the filter completely and display a friendly message in place of the filter,
    as you said i can hide the toggle image, but i cannot hide the input box around the empty message. user should basically feel like there is a label and no dropdown over there(When no values in filter) 

  • Posted on May 2, 2011 (permalink)

    Hello,

    Try the following code snippet in the OnClientDropDownOpening.

    javascript:
    function OnClientDropDownOpening(Sender, args)
       {   
           if (Sender.get_items().get_count() == 0) {
               args.set_cancel(true);
               Sender.clearSelection();
               Sender.set_emptyMessage("No Item!!");
           }
       }

    Thanks,
    Shinu.

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET > Combobox > Hide Dropdown in Combobox