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

Clearing a combobox with load on demand

1 Answer 70 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Silvio Silva Junior
Top achievements
Rank 2
Silvio Silva Junior asked on 20 Apr 2010, 08:29 PM
Hello guys.

I have a combobox with load on demand in a gridtemplatecolumn. For new registries my combo works fine, but, for update I have a problem. In the itemDataBound event (edit mode), I bind the combo with a value and a text (only 1 item), and, when I start the combo's ItemsRequested event, my combo have at the finish, a duplicated item.

I tryed do remove the item in ItemsRequested event,

if (combo.Count == 1)  
   {  
     combo.Items[0].Remove();  
     combo.Text = "";  
     combo.ClearSelection();  
   }          


or, not insert the item that already exist, but I have no sucess.

if (combo.Items.Count > 0) 
            {   
                if ( itemToInsert != combo.Items[0].Value) 
                { 
                    combo.Add(new RadComboBoxItem(TextToInsert, valueToInsert));     
                } 
            } 

What is the best practice for it?

Thanks in advance.

Regards.

1 Answer, 1 is accepted

Sort by
0
Accepted
Veselin Vasilev
Telerik team
answered on 21 Apr 2010, 12:57 PM
Hi Silvio Silva Junior,

Having a static item in load on demand combobox is not a supported scenario.
Please find attached a sample project which shows how to use load on demand combo in RadGrid.

Hope this helps.

All the best,
Veskoni
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.
Tags
ComboBox
Asked by
Silvio Silva Junior
Top achievements
Rank 2
Answers by
Veselin Vasilev
Telerik team
Share this question
or