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

ComboBox with code behind template no longer works

2 Answers 80 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jonathan
Top achievements
Rank 1
Jonathan asked on 29 Jan 2008, 12:17 PM

Hi,

I am going through my code one Telerik control at a time updating them to the Prometheus version and have stumbled across an issue with the new RadComboBox which I cannot fix.

My combobox is loaded with dynamic data from a SQL database and each item consists of an image followed by a string of text.  I had set up a template for this and assigned it programmatically.  This worked perfectly well with the regualar RadComboBox.  Having upgraded to the Prometheus version, I get no images and no text on the combobox items, and having debugged the template, the code never enters the databound control functions listed below (it does enter InstantiateIn).

Can anyone help please as I have checked all the help and this does not seem to have changed between versions?

Thanks in advance.

EntityTypeCombo.ItemTemplate = new ComboBoxHandler.EntityTypeTemplate();  
 
public class EntityTypeTemplate : ITemplate  
{  
    public void InstantiateIn(Control container)  
    {  
        Image image1 = new Image();  
        image1.DataBinding += new EventHandler(image1_DataBinding);  
 
        Label label1 = new Label();  
        label1.ID = "ItemLabel";  
        label1.DataBinding += new EventHandler(label1_DataBinding);  
        container.Controls.Add(image1);  
        container.Controls.Add(label1);  
    }  
 
    private void image1_DataBinding(object sender, EventArgs e)  
    {  
        Image target = (Image)sender;  
        RadComboBoxItem item = (RadComboBoxItem)target.BindingContainer;  
        string itemText = (string)DataBinder.Eval(item, "Value");  
        target.ImageUrl = "images\\" + itemText + ".gif";  
    }  
 
    private void label1_DataBinding(object sender, EventArgs e)  
    {  
        Label target = (Label)sender;  
        RadComboBoxItem item = (RadComboBoxItem)target.BindingContainer;  
        string itemText = " " + (string)DataBinder.Eval(item, "Text");  
        target.Text = itemText;  
    }  
}  
 

2 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 29 Jan 2008, 01:19 PM
Hi Jonathan,

This is fixed in the latest internal build. Please open a formal support ticket and ask for the latest version.

Thanks

Sincerely yours,
Veskoni
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Jonathan
Top achievements
Rank 1
answered on 29 Jan 2008, 01:45 PM
Thanks Veskoni, I thought I was going mad :-)
Tags
ComboBox
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Jonathan
Top achievements
Rank 1
Share this question
or