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

set_value & findItem().select

3 Answers 352 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Piyush Bhatt
Top achievements
Rank 2
Piyush Bhatt asked on 08 Apr 2008, 09:24 PM
I notice that when I call set_value() using Javascript, the Combo is not updated to display the item corresponding to the value. But after that when I click on the drop down, it selects the value.

Instead of that, findItemByValue().select() works. Actually the set_value() should also do the same - don't you think?

Thanks,
Piyush

3 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 09 Apr 2008, 10:39 AM
Hi Piyush,

Thanks for sharing your thoughts.

Your assumption is quite correct. Let me elaborate a bit more on the set_value client-side method of the combobox object. The classic combobox has a server-side Value property. It is used to access the value of the selected item when the items are loaded on demand. This is needed as the items do not persist at the server and hence the SelectedValue property returns nothing.

The new RadComboBox for ASP.NET Ajax does not face this problem - the SelectedValue server-side property now returns the proper value. Therefore, we removed the Value property from the RadComboBox class. Hence, the set_value() client-side method does not change anything. We might consider removing the set_value method so that the users can use the second approach you described.

Regards,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Kevin
Top achievements
Rank 1
answered on 18 Apr 2012, 09:58 PM
I recommend removing the client-side set_value() method from the documentation if it serves no purpose.

Over three years after the last post on this thread the method is still there and confusing current developers (me).
http://www.telerik.com/help/aspnet-ajax/combobox-client-side-radcombobox.html

Thanks,
Kevin
0
Ivana
Telerik team
answered on 23 Apr 2012, 09:34 AM
Hi Kevin,

The set_value(string) method of the client object of RadComboBox is not supposed to select an item which has the passed as argument value -- it simply sets a value to the RadComboBox control itself.
If you test this method by passing a random string as an argument you will notice that this does not make any change in the RadComboBox and if you call the get_value() method it will return the value which you have previously entered --- no matter that it does not match any value in the items collection of RadComboBox.

As for setting a selected value, the recommended way to do that is the following:
$find("RadComboBox1").findItemByValue().select()

Kind regards,
Ivana
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
ComboBox
Asked by
Piyush Bhatt
Top achievements
Rank 2
Answers by
Nikolay
Telerik team
Kevin
Top achievements
Rank 1
Ivana
Telerik team
Share this question
or