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

RadComboBox Select An Item By ID

1 Answer 103 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chandu
Top achievements
Rank 2
Chandu asked on 15 Oct 2012, 02:24 PM
Hello All,

I have working on silverlight4 application,i have started working on RadControls for silverlight.
I have spent a long time solving a issue on RadCombobox regarding selecting the item by its ID.
Here am following the below way to select an item in radcombobox

                for (int i = 0; i < rcbMaintence.Items.Count; i++)
                {
                    if (((MaintenanceCode)rcbMaintence.Items[i]).MaintenanceCodeID == e.Result[0].MaintenanceCodeID)
                    {
                        rcbMaintence.SelectedIndex = i;
                        break;
                    }
                }

Here am getting the data from WCF Service,am getting MaintenanceCodeID by using this ID i need to select MaintenanceCode in combobox.It is working fine,but what my problem is

I have 10's of ComboBoxes on a single page,for all those i need to iterate FOR loops,it is taking so much time
instead of this many for loops i need a simple and fast way to select an item.

Please help me.

1 Answer, 1 is accepted

Sort by
0
Chandu
Top achievements
Rank 2
answered on 22 Oct 2012, 07:30 AM
Hello All,

In .NET we can do something like this to select an item by its ID

if(radComboBox.Items.FindByValue(e.Result[0].MaintenanceCodeID)!=null)
{
      radComboBox.Items.FindByValue(e.Result[0].MaintenanceCodeID).Selected=true;
}

Do we have any option in Silverlight for this

please suggest me.
Tags
ComboBox
Asked by
Chandu
Top achievements
Rank 2
Answers by
Chandu
Top achievements
Rank 2
Share this question
or