Help:: Reseting dropdown to first item (index 0) via Javascript

5 posts, 1 answers
  1. David
    David  avatar
    35 posts
    Member since:
    Dec 2008

    Posted 11 Aug 2010 Link to this post

    I have three RadCombo boxes that interact with each other depending on what the boxes in front has selected.  The combination of Radcombo make up a database product filter of three different search values to populate a repeater control via Radhttppanel.  That is working great (lightweight and quick). 

    I am trying to reset box 2 and 3 to default item (message like width and Length) when I change the selected values in box 1 (material).    I look up and down and inside and out the online docs and did not see anything for setting the selected value on the client side.  It could be simple and I am just  missing it.

    Thanks for any help.
    David
  2. Kamen Bundev
    Admin
    Kamen Bundev avatar
    1532 posts

    Posted 12 Aug 2010 Link to this post

    Hello David ,

    You can use the select() method of RadComboBoxItem to do that. Check the documentation for more information.

    Sincerely yours,
    Kamen Bundev
    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. UI for ASP.NET Ajax is Ready for VS 2017
  4. David
    David  avatar
    35 posts
    Member since:
    Dec 2008

    Posted 12 Aug 2010 Link to this post

    Hi Kamen,

    function SelectComboBoxItem(itemText)
    {
     var combo = $find("<%= RadComboBox1.ClientID %>");
     var item = combo.findItemByText(itemText);
     if(item)
     {
       item.select();
     }
    }

    I guess I need to look for the item by text then select it.

    Thanks,
    David
  5. Answer
    Kamen Bundev
    Admin
    Kamen Bundev avatar
    1532 posts

    Posted 13 Aug 2010 Link to this post

    Hello David ,

    No, you can just select the item you want by its index:
    function selectFirstItem() {
        var combo = $find("<%= RadComboBox1.ClientID %>");
        if (combo)
            combo.get_items().getItem(0).select();
    }

    Kind regards,
    Kamen Bundev
    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
  6. David
    David  avatar
    35 posts
    Member since:
    Dec 2008

    Posted 13 Aug 2010 Link to this post

    Thanks, I am just getting back around to the dropdowns after working on other sections of the app like the dynamic wall color changer.  That is working great now.  RadCombo combine with the RadXmlHttpPanel  makes a great floor sample filter for this app.  Hopefully I will have the new web app launch in the next week or so. 



Back to Top
UI for ASP.NET Ajax is Ready for VS 2017