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

Programmatcially add ItemTemplate item

1 Answer 95 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
James Shelton Agar
Top achievements
Rank 2
James Shelton Agar asked on 24 Sep 2009, 05:30 AM
Hi there, just to avoid confusion, I am not asking about adding ItemTemplate in run time.

At moment, we can add normal radcombobox items with .items.add, how can we do equivalent for itemtemplate items? If we don't rebind it everytime anything new.

Searched for posts and get no result, pls help, thanks

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Sep 2009, 07:06 AM
Hi James,

I guess you want to add dynamically created control to RadComboBox's ItemTemplate control from code behind. I tried following code which adds a new control to RadComboBox Item, that is similar to adding ItemTemplate control. Hope this helps.

C#:
 
protected void Button1_Click(object sender, EventArgs e) 
    foreach( RadComboBoxItem item in RadComboBox1.Items ) 
    { 
        TextBox TextBox1 = new TextBox(); 
        item.Controls.Add(TextBox1); 
    } 

Note: The documentation shows how to add ItemTemplate at runtime: Adding Templates

-Shinu.
Tags
ComboBox
Asked by
James Shelton Agar
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Share this question
or