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; |
} |
} |