How to set selected value after load on demand

2 posts, 0 answers
  1. James Daresta
    James Daresta avatar
    65 posts
    Member since:
    Sep 2009

    Posted 11 Oct 2013 Link to this post

    I have a combo with load on demand and I refresh via javascript. What I want is the combo to populate items and then go and selected item that matches a value id. So for example:

      OlinCA.loadStates = function (country, selectedState) {
        var rcbContactState = $find("<%= rcbContactState.ClientID %>");
        rcbContactState.requestItems((country + '~' + selectedState), false);

    As you see I am passing a value to populate the combo by a selected country and then select a matching state. Well every time I call that findItemByValue I get an error because that line fires before the list is populated. I need somehow to have the load request finish first. I tried to select a value via the server side code, but nothing gets selected. What is the way I can do the selection like I need to?

  2. Hristo Valyavicharski
    Hristo Valyavicharski avatar
    975 posts

    Posted 16 Oct 2013 Link to this post

    Hi James,

    The RadComboBox makes requests and this may take little longer time. That's why you may handle OnClientItemsRequested event, which you be fired immediately after the combo loads the filtered items and then call findItemByValue(). Something similar to this:

    function OnClientItemsRequested(sender, args) {

    Hristo Valyavicharski
    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 the blog feed now.
Back to Top