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

[Solved] Selecting Comobox Items

1 Answer 94 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Lynne
Top achievements
Rank 1
Lynne asked on 01 Sep 2009, 06:09 PM

The last post I created with that title was unreadable so I am trying again.

I want to make one RadCombobox have the same selection as another.  They both have the same items and if I select "5" on one, I want the other to automatically be the same.  This used to work in previous versions of the RadComboboxes, allowing the actual and billable minutes comboboxes to be the same.

The following used to work in previous versions of the RadCombobox but doesn't any more.

 function ActualMinutesChanged(item){  
      var minutesCombo = <%= BillableMinutes.ClientID %>;  
      minutesCombo.FindItemByValue(item.ComboBox.GetValue()).Select();  
 } 

I have changed the code to the following but I need to now how to actually select an item in the second combobox (billable minutes) to be the same as the actual minutes.

    function ActualHoursChanged(sender, eventArgs){  
        var item = eventArgs.get_item();  
        var hours = item.get_index();  
        var hoursCombo = $find("<%= BillableHours.ClientID %>");  
        hoursCombo._selectedIndex = hours;  
    } 

So, how do I select using the new client-side JavaScript code?  Thanks!

1 Answer, 1 is accepted

Sort by
0
Paul
Telerik team
answered on 02 Sep 2009, 10:48 AM
Hi Lynne,

Here's your modified code snippet that shows the needed approach.

<script type="text/javascript"
        function ActualHoursChanged(sender, eventArgs) { 
            var item = eventArgs.get_item(); 
            var hours = item.get_index(); 
            var hoursCombo = $find('<%= RadComboBox2.ClientID %>'); 
            hoursCombo.get_items().getItem(hours).select(); 
        } 
    </script> 


Sincerely yours,
Paul
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
ComboBox
Asked by
Lynne
Top achievements
Rank 1
Answers by
Paul
Telerik team
Share this question
or