New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

ItemTemplate Event Problems

Let's say you have placed a simple HTML TextBox in an ItemTemplate of RadComboBox.

RadComboBox will intercept all the input events - mouse_clicks, key_ presses, etc. Any mouse_click inside the drop-down will immediately close the drop-down - even if you click inside the TextBox. This issue is due to the DOM event bubbling - any event from child element (e.g. the TextBox) bubbles up to its parent (the combobox) unless bubbling is stopped. To solve the problem, cancel the event bubbling and enable the text selection you should use the following approach:

<itemtemplate>   
    <input type="text" onclick="event.cancelBubble=true" onselectstart="event.cancelBubble=true" />
</itemtemplate>

Even if you place RadTreeView inside an ItemTemplate of RadComboBox, you can use an approach similar to the one above by wrapping the tree control with a DIV tag, like:

<div onclick="event.cancelBubble=true">
In this article