This is a migrated thread and some comments may be shown as answers.

RadComboBox closing RadMenu

3 Answers 97 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jacques
Top achievements
Rank 2
Jacques asked on 23 Apr 2012, 10:08 AM
Hi, 

I have this issue with a RadComboBox closing my RadMenu drop down sub menu. I can click on input boxes and so forth and I can click to expand the ComboBox without it closing the RadMenu item, but when I select any of the items within the ComboBox it closes the RadMenu item. 

How can I prevent it from doing that? 

Regards,
Jacques

3 Answers, 1 is accepted

Sort by
0
Accepted
Peter
Telerik team
answered on 23 Apr 2012, 11:54 AM
Hi Jacques,

This is expected behavior because RadComboBox detaches its dropdown element and places it outside the menu item template area. To avoid this, please use the following workaround:
<script type="text/javascript">
       var flag = false;
 
       function OnClientItemClosing(sender, args) {
           args.set_cancel(flag);
       }
 
       function OnClientDropDownOpening(sender) {
           flag = true;
       }
 
       function OnClientDropDownClosed(sender) {
           setTimeout(function() { flag = false; }, 200);
 
       }
   </script>
   <telerik:RadMenu ID="RadMenu1" runat="server" OnClientItemClosing="OnClientItemClosing">
       <Items>
           <telerik:RadMenuItem runat="server" Text="Root RadMenuItem1">
               <Items>
                   <telerik:RadMenuItem runat="server" Text="Child RadMenuItem 1">
                       <ItemTemplate>
                           <telerik:RadComboBox ID="RadComboBox1" runat="server" Style="z-index: 99999" OnClientDropDownOpening="OnClientDropDownOpening"
                               OnClientDropDownClosed="OnClientDropDownClosed">
                               <Items>
                                   <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem1" Value="RadComboBoxItem1" />
                                   <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem2" Value="RadComboBoxItem2" />
                                   <telerik:RadComboBoxItem runat="server" Text="RadComboBoxItem3" Value="RadComboBoxItem3" />
                               </Items>
                           </telerik:RadComboBox>
                           <br />
                           <br />
                           <br />
                           <br />
                           <br />
                           <br />
                           <br />
                           <br />
                           <br />
                           <br />
                           <br />
                           <br />
                           <br />
                       </ItemTemplate>
                   </telerik:RadMenuItem>
               </Items>
           </telerik:RadMenuItem>
           <telerik:RadMenuItem runat="server" Text="Root RadMenuItem2">
           </telerik:RadMenuItem>
           <telerik:RadMenuItem runat="server" Text="Root RadMenuItem3">
           </telerik:RadMenuItem>
       </Items>
   </telerik:RadMenu>


Kind regards,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Shawn
Top achievements
Rank 1
answered on 19 Oct 2012, 07:51 PM
Can you provide an equivalent workaround for Silverlight? I am facing the exact same issue...

Thanks!
0
Shawn
Top achievements
Rank 1
answered on 19 Oct 2012, 09:16 PM
Tags
ComboBox
Asked by
Jacques
Top achievements
Rank 2
Answers by
Peter
Telerik team
Shawn
Top achievements
Rank 1
Share this question
or