issue with Related ComboBoxes

4 posts, 0 answers
  1. yao wang
    yao wang avatar
    25 posts
    Member since:
    May 2010

    Posted 10 Aug 2010 Link to this post

    http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multiplecomboboxes/defaultcs.aspx

    I use the method in above link to implement cascading dropdown list. However I have two issues can not be fixed using the above method.

    1. In the last combobox(in above link, it is the city combobox), I set postback = true. However after page postback, the selected value in each combobox is lost. How can I retrieve the selected value for each combobox? Especially for the last combobox?


    2. If there is only one selection in combobox, how to disable dropdown function in the combobox . For example, in the above link, if I choose “Asia” in continent combobox, “china” in country combobox,  the “Beijing” will be only one selection in city combobox. How to let “beiJing” display in city combobox directly  and disable its dropdown function?  


    From my understanding, the above method is using web service to implement cascading dropdown function, therefore it is stateless even within a same page. I am not sure if issue #1 is related with the stateless feature.  

     

    Thanks,

     

    Yao

  2. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 16 Aug 2010 Link to this post

    Hi yao wang,

    You can retain the selection in the RadComboBoxes if you set their AllowCustomText properties to true. Otherwise the controls loose their selected values because the Load on Demand Items do not persist across postbacks.

    You can achieve the second requirement by handling the client-side ItemsRequested and DropDownOpening events of the target RCB in this way respectively:
    function onItemsReqested(sender, eventArqs) {
        sender._preventDropDownOpening = false;
     
        if (sender.get_items().get_count() == 1) {
            // pre-select the first item
            sender.get_items().getItem(0).select();
            sender._preventDropDownOpening = true;
        }
        else if (sender.get_items().get_count() > 1)
            sender.showDropDown();   
    }
     
    function onDropDownOpening(sender, eventArgs) {
        eventArgs.set_cancel(sender._preventDropDownOpening);
    }

    I hope this helps.

    Best wishes,
    Simon
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. yao wang
    yao wang avatar
    25 posts
    Member since:
    May 2010

    Posted 17 Aug 2010 Link to this post

    For the second issue, is it possible to give me the sample code?

    thanks a lot.

    Yao
  4. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 17 Aug 2010 Link to this post

    Hi yao wang,

    The code I provided in my previous post resolves the second issue. Did you test it on your end?

    Kind regards,
    Simon
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top