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

[Solved] SelectedValue vs. set_value()

1 Answer 166 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Saed
Top achievements
Rank 1
Saed asked on 16 May 2009, 10:23 AM
Hi there,

In server-side, SelectedValue property is used to get/set the value of selected item. In client-side, the property is split into 2: get_value() and set_value()... That's known and understood.

I have a scenario where I wish to cast the value of clicked Node of a tree to select the item with same value in a respective combobox. In server-side, I could easily achieve that:

Dim nodeValue As String = myTV.SelectedValue 
myCombo.SelectedValue = nodeValue 

However, when I tried the same in client-side, it didn't work!

var nodeValue = tree.get_selectedNode().get_value()); 
combo.set_value(nodeValue); 

Using set_value() didn't accomplish a thing! The only way to work this out was to search for the item with similar value THEN select it:

var nodeValue = tree.get_selectedNode().get_value()); 
combo.findItemByValue(nodeValue).select(); 

In light of that, I'm wandering why I can't accomplish said task fair and straight, thus, this workaround? What's the benefit of set_value() in this case? Is it a bug or Am I missing something here?

Regards,
Saed

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 18 May 2009, 08:22 AM
Hello Saed,

Actually, client-side set_value() is not the same as the server-side SelectedValue, set_value only sets the value of the combobox, so you're using the right way to select an item client-side.

All the best,
Yana
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
ComboBox
Asked by
Saed
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or