Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
444
Hide a webdropdown on the client?
posted

Hi All,

I have a templated webdropdown. I'm using jQuery. I want to add an event to the webdropdown to hide after a selection is made. I added a client handler <ClientEvents SelectionChanged="selectionChanged" />. It hits my function but I can't find out how to hide the dropdown. There is almost no documentation for the CSOM as I'm sure you're aware. Anyways I'm trying to do the Ajax live form design pattern. A user selects an item, the selected value is put into a label...the drop down dissappears... if a user clicks the label, the label(span) becomes hidden and the dropdown is redisplayed. yada yada yada..

I have done list thousands of times with a standard "Select" element (DropDownList), I basically just need to know how to show and hide the WebDropDown using the CSOM or a combination of CSOM and jQuery

In jQuery I can use $("# elementId").hide() can I do something similiar with the WebDropDown component?

Parents
No Data
Reply
  • 24671
    posted

    Hi,

    If EnableClosingDropDownOnSelect=true, the dropdown should close automatically when a selection is made. You can also always close it programatically by using the closeDropDown() client-side function:

     

    $find("WebDropDown1").closeDropDown(); 

    there is also openDropDown(); 

    you can also achieve this on a lower-level by doing $find("WebDropDown1").behavior.set_visible(false);

    or set_visible(true); 

    The above is for the dropdown list. Do you want to actually hide the whole control (including the input box, the dropdown list, etc.) ? 

    Hope it helps,

    Angel 

Children
No Data