RadComboBox - select value in Javascript

2 posts, 0 answers
  1. Dave Hollen
    Dave Hollen avatar
    46 posts
    Member since:
    Jan 2010

    Posted 22 Mar 2011 Link to this post

    Hello,

    I am using a RadComboBox on an Ajax Modal Popup Extender.

    What I am attempting to do is to select a specific item in the combo box and have that item displayed as the selected item in the combo box.  Prior to displaying the popup that contains the combo box, the combo box is populated and I know the Value of the item that I want to select.

    Here is the javascript I am using:

    rcbSearchOffices.trackChanges();

    rcbSearchOffices.set_value(defaultOfficeId.value);

     

    var

    item = rcbSearchOffices.findItemByValue(defaultOfficeId.value);

     

     

    rcbSearchOffices.set_selectedItem(item);

     

    rcbSearchOffices.updateClientState();

    rcbSearchOffices.commitChanges();


    However, when the combo box is displayed, the item that I am trying to select is not visibly selected unless I click on the combo box.  If I click on the combo box, I am automatically taken to that item.  What I want to happen is that the item is automatically displayed as the selected item in the combo box.

    How do I do this?

    Thanks!

  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 23 Mar 2011 Link to this post

    Hello,


    I am not sure about the issue that you are facing. Maybe another option for selectng an item in the RadComboBox will do the trick for you. Give a try by calling the select() method of RadComboBoxItem client object instead of calling set_selectedItem().


    rcbSearchOffices.trackChanges();
        .  .  .

    var item = rcbSearchOffices.findItemByValue(defaultOfficeId.value);
    item.select();
    rcbSearchOffices.commitChanges();



    Thanks,
    Princy.
Back to Top