Version

Setting Height and Width of DropDown Container

The dropdown container of WebDropDown™ displays a list of all the available data items. By default, the dropdown container will automatically resize so that all the items are displayed. However , you may have a large list of items and it is not possible to simultaneously display all items. In this scenario you can set the height and width of the dropdown container using the DropDownContainerHeight and DropDownContainerWidth properties. Setting the height and width results in displaying vertical and horizontal scrollbars in case the value list exceeds the height or width that is set by the developer.

The WebDropDown also allows you to set the maximum height of the dropdown container using the property DropDownContainerMaxHeight. Setting the DropDownContainerMaxHeight property has the following results:

  • If the height of the value list is less than the maximum height property value, the height is set to grow to these items only with no scrollbar or with an empty area below these items.

  • If the height of the value list is greater than the maximum height property value, the height is set to the maximum height property value and the WebDropDown displays a vertical scrollbar.

To set the height and width of dropdown container :

  • The WebDropDown allows you to set the height and width of the dropdown container either using the Microsoft® Visual Studio® Property Window or by using the following code :

In Visual Basic:

WebDropDown1.DropDownContainerWidth = 200;
WebDropDown1.DropDownContainerHeight = 300;

In C#:

WebDropDown1.DropDownContainerWidth = 200;
WebDropDown1.DropDownContainerHeight = 300;
  • You can also set the maximum height of the dropdown container either using the property window or through the following code :

In Visual Basic:

WebDropDown1.DropDownContainerMaxHeight = 500;

In C#:

WebDropDown1.DropDownContainerMaxHeight = 500;