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

Can you find items by value?

2 Answers 350 Views
ComboBox and ListBox (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bex
Top achievements
Rank 1
Bex asked on 04 Mar 2009, 02:29 PM
Hello

This is the first time using a windows forms combobox and am trying to find an item by value like I did with a web drop down but can't seem to do it.
What do I need to do to do this with a window combo?

Thanks

Bex

2 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 07 Mar 2009, 12:43 PM
Hello Becky,

Thank you for your interest in our products.

Currently, you cannot find an item by its value out of the box. However, you can easily implement your own FindByValue method. I made such sample implementation for you:
private RadComboBoxItem FindByValue(RadComboBox radComboBox, object value)  
{  
    foreach (RadComboBoxItem item in radComboBox.Items)  
    {  
        if (item.Value.Equals(value))  
        {  
            return (RadComboBoxItem)item;  
        }  
    }  
 
    return null;  

I am attaching a sample project to demonstrate this method in use. If you have additional questions, feel free to contact me.

Regards,
Nikolay
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Bex
Top achievements
Rank 1
answered on 09 Mar 2009, 09:39 AM
Hi Nikolay!

Thanks for yor help!

Bex
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
Bex
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Bex
Top achievements
Rank 1
Share this question
or