I noticed that the RadComboBoxItem class has an ImageUrl property but there doesnt seem to be a binding property on the main combo to allow for databinding for property. Seems to me that have a RadComboBox.DataImageUrl field would be nice on the main combo.
Do I need to create a templated item in order to do this?
Thanks
Do I need to create a templated item in order to do this?
Thanks
5 Answers, 1 is accepted
0
Serrin
Top achievements
Rank 1
answered on 03 Oct 2008, 05:48 PM
Hey Randy,
You can see this demonstrated in the First Look application as well as an example in the Custom Attributes for ComboBox online demo. Look at the code for the Avatar dropdown section and you can see DataBinder.Eval being used to put images into the template.
You can see this demonstrated in the First Look application as well as an example in the Custom Attributes for ComboBox online demo. Look at the code for the Avatar dropdown section and you can see DataBinder.Eval being used to put images into the template.
0
Randy
Top achievements
Rank 1
answered on 03 Oct 2008, 05:52 PM
Yes. I saw that example. My question was whether or not there is a building mechnism that allows you to tap into the RadComboBoxItem.ImageUrl property without having to revert to a templated item. It is a little more work to create a template rather than a simple DataBind.
0
Hi Randy,
You can bind any additional properties (like ImageUrl) in the ItemDataBound event.
I hope this helps.
Sincerely yours,
Veskoni
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
You can bind any additional properties (like ImageUrl) in the ItemDataBound event.
I hope this helps.
Sincerely yours,
Veskoni
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
peter
Top achievements
Rank 1
answered on 22 May 2009, 12:26 PM
I am binding a Combo box to a object datasource on my page
I then use the OnItemDataBound event to set the image url. The url for the image is in my datasource. The image is not displayed when the page renders. The URL is correct as I use it with the toolbar control on my menu and this works perfectly. I am using the latest download css and DLL.
Any ideas ?
tks H
<asp:ObjectDataSource runat="server" ID="odsLanguage" TypeName="Gottmi.Web.Helpers.LanguageHelper"
SelectMethod="List"
DataObjectTypeName="Gottmi.DLL.Language"
CacheDuration="360"
CacheExpirationPolicy="Sliding"
EnableCaching="true"></asp:ObjectDataSource>
protected void ddlLanguage_OnItemDataBound(object sender, Telerik.Web.UI.RadComboBoxItemEventArgs e)
{
Gottmi.DLL.Language language = (Gottmi.DLL.Language)e.Item.DataItem;
if (language != null && !string.IsNullOrEmpty(language.ImageUrl))
{
e.Item.ImageUrl = language.ImageUrl;
}
}
I then use the OnItemDataBound event to set the image url. The url for the image is in my datasource. The image is not displayed when the page renders. The URL is correct as I use it with the toolbar control on my menu and this works perfectly. I am using the latest download css and DLL.
Any ideas ?
tks H
0
Hello peter,
Can you please check what is the full path of the image that is being rendered for every item and see if those files exist.
Kind regards,
Veselin Vasilev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Can you please check what is the full path of the image that is being rendered for every item and see if those files exist.
Kind regards,
Veselin Vasilev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.