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

[Solved] radCombobox.Items always showing a count of 0

2 Answers 182 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Joshua Wise
Top achievements
Rank 1
Joshua Wise asked on 14 Dec 2009, 08:52 PM
Hi all,

I'm trying to build a user control that has a radCombox on it.  One of the features of the combobox is that you can list the ID's of child radcomboboxes that will clear when the ItemsRequested event fires on the parent box.  However, when I run the following code to get the child radComboBox, the Item.count is always 0, and the items in the box never clear, even when I clearly see items in the child radComboBox.
 
  private void ClearChildren() 
    { 
        RelationalComboBox Child; 
 
        string[] ChildrenList = _Children.Split(_ChildrenDelimeter.ToCharArray()); 
 
        for (int i = 0; i < ChildrenList.Length; i++) 
        { 
            Child = (RelationalComboBox)this.Parent.FindControl(ChildrenList[i]); 
            Child.radComboBox.Text = " "
            Child.radComboBox.ClearSelection(); 
 
            do 
            { 
                if (Child.radComboBox.Items.Count > 0) 
                { 
                    Child.radComboBox.Items[0].Remove(); 
                } 
            } while (Child.radComboBox.Items.Count > 0); 
 
 
      
        } 
    } 


Any ideas how I can get the other radComboBox control and clear it's items?  

Thanks,
Joshua Wise
Aramark





2 Answers, 1 is accepted

Sort by
0
sitefinitysteve
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 15 Dec 2009, 04:28 AM
So this is called from ItemsRequested?
0
Simon
Telerik team
answered on 16 Dec 2009, 11:14 AM
Hi Joshua,

In the ItemsRequested event handler only the initiator RadComboBox's state (mainly the Text and SelectedValue properties) is available on the server. Additionally any changes to other controls or to the RC do not have effect except the Items added to the initiator RCB.

So, clearing other RCBs in the ItemsRequested event handler will not work. Please consider doing so on the client in the client-side ItemsRequested event handler.

Sincerely yours,
Simon
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
Joshua Wise
Top achievements
Rank 1
Answers by
sitefinitysteve
Top achievements
Rank 2
Iron
Iron
Veteran
Simon
Telerik team
Share this question
or