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

RADComboBox not collapsing when moving focus to RADEditor

6 Answers 138 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 03 Sep 2008, 10:33 AM
Hi,

I have a RADComboBox on a page, when click it I get the drop down as expected, however if I then click within the RADEditor on the page the drop down region does not collapse.  Its as though it is not aware that it has lost focus?

You can reproduce the problem with the code below:

<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server"
    <title></title
</head> 
<body> 
    <form id="form1" runat="server"
    <div> 
        <asp:ScriptManager runat="server" ID="ScriptManager1"
        </asp:ScriptManager> 
        <telerik:RadComboBox ID="RadComboBox1" runat="server"
        <Items> 
            <telerik:RadComboBoxItem runat="server" Value="test1" Text="test1" /> 
            <telerik:RadComboBoxItem runat="server" Value="test2" Text="test2" /> 
        </Items> 
        </telerik:RadComboBox> 
        <telerik:RadEditor ID="RadEditor1" runat="server"
        </telerik:RadEditor> 
    </div> 
    </form> 
</body> 
</html> 
 


Any ideas?

Thanks,

Jeff

6 Answers, 1 is accepted

Sort by
0
Helen
Telerik team
answered on 03 Sep 2008, 03:41 PM
Hello Jeff,

You may workaround the problem by using the following code:

<script type="text/javascript">  
       function OnClientLoad(editor, args)  
        {  
             
           var element = document.all ? editor.get_document().body : editor.get_document();  
           $telerik.addExternalHandler(element, "click", function(e)  
           {  
               var combo = $find("<%=RadComboBox1.ClientID %>");  
               combo.hideDropDown();  
           });  
        }  
 
    </script> 
    <asp:ScriptManager id="ScriptManager1" runat="server"></asp:ScriptManager>   
        <div>   
            <telerik:RadComboBox ID="RadComboBox1" runat="server">    
        <Items>    
            <telerik:RadComboBoxItem runat="server" Value="test1" Text="test1" />    
            <telerik:RadComboBoxItem runat="server" Value="test2" Text="test2" />    
        </Items>    
        </telerik:RadComboBox>    
        <telerik:RadEditor ID="RadEditor1" runat="server" OnClientLoad="OnClientLoad">    
        </telerik:RadEditor> 


Kind regards,
Helen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jeff
Top achievements
Rank 1
answered on 08 Sep 2008, 09:49 AM
Hi,

Thanks for your solution unfortunately this gives an error if you click on the editor before clicking on the drop down. Also if you do click on the combo first, then to the editor the drop down does hide as expected, however if you click on say a textbox and then move back to the editor the drop down is shown and then hidden again??!

Any ideas?

Thanks,

Jeff
0
Accepted
Veselin Vasilev
Telerik team
answered on 08 Sep 2008, 12:52 PM
Hi Jeff,

Excuse us for the error.
Please try this javascript method:

function OnClientLoad(editor, args)   
  var element = document.all ? editor.get_document().body : editor.get_document();   
  $telerik.addExternalHandler(element, "click"function(e)   
  {   
    var combo = $find("<%=RadComboBox1.ClientID %>");   
    if (combo.get_dropDownVisible()) { 
       combo.hideDropDown();  } 
   });   
}  

I hope this helps.

Regards,
Veskoni
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Chris Dalessandri
Top achievements
Rank 1
answered on 01 Oct 2008, 12:47 PM
I am having the same problem except that my Editor is on a usercontrol, and the combobox is on a different control.  My Editor usercontrol is used on many pages and there is no way to explicitly know the name of every combobox that could overlap it.

Is there a more generic way to do this that does not require knowing the id of all the comboboxes?

thanks.
0
Rosi
Telerik team
answered on 01 Oct 2008, 01:44 PM
Hello Chris ,

You can use Telerik.Web.UI.RadComboBox.ComboBoxes array . It contains all the combobox instances on the page. More about it you can read here.


Regards,
Rosi
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Chris Dalessandri
Top achievements
Rank 1
answered on 01 Oct 2008, 02:49 PM
that works great. Here is the small change I made that allows this method to work on ever page.

function OnClientLoad(editor, args)    
{  
  var element = document.all ? editor.get_document().body : editor.get_document();    
  $telerik.addExternalHandler(element, "click", function(e)    
  {   
    var lastCombo = Telerik.Web.UI.RadComboBox.ComboBoxes.length-1; 
    for(i = 0;i<=lastCombo;i++) 
    { 
        var combo = Telerik.Web.UI.RadComboBox.ComboBoxes[i]; 
        if (combo.get_dropDownVisible()) {  
           combo.hideDropDown();  }  
    } 
   });    
}   
 


Tags
ComboBox
Asked by
Jeff
Top achievements
Rank 1
Answers by
Helen
Telerik team
Jeff
Top achievements
Rank 1
Veselin Vasilev
Telerik team
Chris Dalessandri
Top achievements
Rank 1
Rosi
Telerik team
Share this question
or