We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to prevent text wrp in Dropdown popup when the text content exceeds the popup width

Description

When DropDownList is set with a PopupWidth and if the text value is longer than the given width, then the text will be wrapped inside the popup element. To prevent DropDownList items text wrapping and get horizontal scroller in popup element, you can set the CSS style “white-space” value as “no-wrap” for the DropDownList items.

Solution

Define a DropDownList control and bind create event for it. In the create event handler, get the DropDownList object and set the CSS “white-space” as “no-wrap” for all list elements inside the DropDownList. This will prevent the text wrap of DropDownList items. To get the horiziontal Scroller for the popup, set the popup list wrapped width for the Scroller object and refresh() the Scroller. Refer the following code block,

HTML

JavaScript

Output DropDownList items without text wrap,

Figure 1: Popup element with a horizontal Scroller

Article ID: Published Date: Last Revised Date: Platform: Control:
8052 11/03/2017 11/03/2017 JavaScript ejDropDownList
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.