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

set_text is not allways working on first try

1 Answer 60 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Mattias
Top achievements
Rank 1
Mattias asked on 07 Nov 2011, 03:26 PM
Hi,
I'm using this code:
function nodeClicking(sender, eventArgs) {
   var comboBox = $find("<%= radComboBoxUnits.ClientID %>");
   var node = eventArgs.get_node()
   node.set_selected(true);
   comboBox.set_text(node.get_text());
   comboBox.hideDropDown();
}

But sometimes I need to click twice on a node for the text to show up in the combobox.
I click once, and the combobox collapses but the combobox text is still the old one.
I open the combobox again and clicks on a node, this time the text is showing up.
Why is that? Can I change this code for any other "working" code?

Most of the times it works as it should, but sometimes, randomized, it's not working.

Regards,
Mattias

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 08 Nov 2011, 05:01 AM
Hello Mattias,

You can try the following javascript.

JS:
<script type="text/javascript">
 function OnClientNodeClicking(sender, args)
  {
    var nodetxt = args.get_node().get_text();
    var combo = $find("<%= RadComboBox1.ClientID %>");
    combo.set_text(nodetxt);
  }
</script

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