set_value & findItem().select

4 posts, 0 answers
  1. Piyush Bhatt
    Piyush Bhatt avatar
    166 posts
    Member since:
    Nov 2007

    Posted 08 Apr 2008 Link to this post

    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?

  2. Nikolay
    Nikolay avatar
    3997 posts

    Posted 09 Apr 2008 Link to this post

    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.

    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Kevin
    Kevin avatar
    27 posts
    Member since:
    Aug 2012

    Posted 18 Apr 2012 Link to this post

    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).

  4. Ivana
    Ivana avatar
    657 posts

    Posted 23 Apr 2012 Link to this post

    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:

    Kind regards,
    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.
Back to Top