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

[Solved] RadtreeView with RadCombo

1 Answer 108 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Gerry
Top achievements
Rank 1
Gerry asked on 22 May 2009, 08:20 AM
Hi,

I have a RadTreeView Control inside a RadCombo template which is based on the Telerik samples.
The only change I have made is to bind the RadTreeView to a LinqDataSource. All works fine with one exception:

How do I prevent the RadCombo from closing if the selected node has no parents (top-level node) ?
In other words, I want to force a user to select a child node.

Thank you in advance

Gerry 






1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 22 May 2009, 10:54 AM
Hello Gerry,

You can actually check if the node clicked is a rootnode in the onClientNodeClicked client event if so cancel the dropdownclosing client event as shown below:
js:
<script type="text/javascript"
var flag; 
function NodeClicked(sender, eventArgs) // OnClientNodeClicked event of RadTreeView 
 
  var node = eventArgs.get_node();   
  if(node.get_level() == 0) // check if rootnode 
  { 
    flag = true
  } 
  else 
  { 
    flag = false
  } 
   
 
function DropDownClosing(sender, eventArgs) // OnClientDropDownClosing event of RadComboBox 
 
  if(flag==true
  { 
    eventArgs.set_cancel(true);  
  } 
  else 
  { 
    eventArgs.set_cancel(false); 
  } 
</script> 

Thanks
Princy.
Tags
ComboBox
Asked by
Gerry
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or