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

LostFocus change selected item

3 Answers 131 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Fabiano Damasceno
Top achievements
Rank 1
Fabiano Damasceno asked on 16 Jan 2012, 08:28 PM
Hi all,

I'm facing a strange behaviour. I have a RadComboBox, it is populated on server side, like this:

 

RadComboBox1.Items.Add(new Telerik.Web.UI.RadComboBoxItem("Value  1 - 1", "1")); 
RadComboBox1.Items.Add(new Telerik.Web.UI.RadComboBoxItem("Value  1 - 2", "1")); 
RadComboBox1.Items.Add(new Telerik.Web.UI.RadComboBoxItem("Value  1 - 3 ", "1")); 
RadComboBox1.Items.Add(new Telerik.Web.UI.RadComboBoxItem("Value  2", "2"));

As can be see, three items have the same value (1). The problem is, in the client side, I select a item, for exemple, "Value 1 - 3", so, when the combobox last the focus, the item will be automatic set to "Value 1 - 1".

Why this happen? Is there a way to stop this?

Thanks.

3 Answers, 1 is accepted

Sort by
0
Accepted
Kalina
Telerik team
answered on 17 Jan 2012, 11:05 AM
Hi,

The values of the RadComboBox items have to be unique - please take a look at the "RadComboBox selects a different item" help article.

Greetings,
Kalina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Fabiano Damasceno
Top achievements
Rank 1
answered on 17 Jan 2012, 11:26 AM
Thanks Kalina,

Is there a known way to work around it? I ask because it's realy necessary to have more then one item with the same value.
0
Kalina
Telerik team
answered on 17 Jan 2012, 03:29 PM
Hello,

I am suggesting you set the item values to unique numbers.
Then you can store these repeating numbers that you currently set as values within the RadComboBoxItem Custom Attributes collection.  
Please find more details about Custom Attributes at this help article.

All the best,
Kalina
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
ComboBox
Asked by
Fabiano Damasceno
Top achievements
Rank 1
Answers by
Kalina
Telerik team
Fabiano Damasceno
Top achievements
Rank 1
Share this question
or