This is a migrated thread and some comments may be shown as answers.

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

4 Answers 184 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 11 Aug 2010, 06:18 PM
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

4 Answers, 1 is accepted

Sort by
0
Kamen Bundev
Telerik team
answered on 12 Aug 2010, 09:45 AM
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
0
David
Top achievements
Rank 1
answered on 12 Aug 2010, 07:01 PM
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
0
Accepted
Kamen Bundev
Telerik team
answered on 13 Aug 2010, 08:56 AM
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
0
David
Top achievements
Rank 1
answered on 13 Aug 2010, 02:52 PM
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. 



Tags
ComboBox
Asked by
David
Top achievements
Rank 1
Answers by
Kamen Bundev
Telerik team
David
Top achievements
Rank 1
Share this question
or