|
| 1 | +--- |
| 2 | +title: How to Display RadDropDownList Dropdown Popup in AjaxControlToolkit ModalPopup Window |
| 3 | +description: Learn how to increase the z-index of the RadDropDownList dropdown popup to display it correctly within an AjaxControlToolkit modal popup window. |
| 4 | +type: how-to |
| 5 | +page_title: Display RadDropDownList Dropdown Popup in AjaxControlToolkit ModalPopup Window |
| 6 | +slug: dropdownlist-display-dropdown-popup-ajaxcontroltoolkit-modalpopup-window |
| 7 | +tags: raddropdownlist, ajaxcontroltoolkit, modalpopup, dropdown-popup, z-index |
| 8 | +res_type: kb |
| 9 | +--- |
| 10 | + |
| 11 | +## Environment |
| 12 | + |
| 13 | +| Property | Value | |
| 14 | +| --- | --- | |
| 15 | +| Product | RadDropDownList for ASP.NET AJAX | |
| 16 | +| Version | all | |
| 17 | + |
| 18 | +## Description |
| 19 | + |
| 20 | +When using an AjaxControlToolkit modalpopup window, the RadDropDownList dropdown popup may not be displayed correctly. |
| 21 | + |
| 22 | +## Solution |
| 23 | + |
| 24 | +To address this issue and ensure that the RadDropDownList dropdown popup is displayed correctly within the AjaxControlToolkit modalpopup window, you can follow these steps: |
| 25 | + |
| 26 | +1. Add the following JavaScript code to your page: |
| 27 | + |
| 28 | +```javascript |
| 29 | +<script> |
| 30 | + function popupOpening(sender, args) { |
| 31 | + var popup = sender.get_dropDownElement(); |
| 32 | + setTimeout(function () { |
| 33 | + popup.style.setProperty('z-index', '103000', 'important'); |
| 34 | + }); |
| 35 | + } |
| 36 | +</script> |
| 37 | +``` |
| 38 | + |
| 39 | +2. Modify your RadDropDownList control by adding the `OnClientDropDownOpening` attribute and set it to the `popupOpening` JavaScript function: |
| 40 | + |
| 41 | +```html |
| 42 | +<telerik:RadDropDownList ID="ddlMatch" runat="server" OnClientDropDownOpening="popupOpening"> |
| 43 | + <Items> |
| 44 | + <telerik:DropDownListItem Value="1" Text="Item1" /> |
| 45 | + <telerik:DropDownListItem Value="2" Text="Item2" /> |
| 46 | + <telerik:DropDownListItem Value="3" Text="Item 3" /> |
| 47 | + </Items> |
| 48 | +</telerik:RadDropDownList> |
| 49 | +``` |
| 50 | + |
| 51 | +By implementing these steps, you will increase the z-index of the RadDropDownList dropdown popup, allowing it to be displayed correctly within the AjaxControlToolkit modalpopup window. |
0 commit comments