RadListbox Image URL

2 posts, 0 answers
  1. Anirudh
    Anirudh avatar
    1 posts
    Member since:
    Aug 2016

    Posted 26 Aug 2016 Link to this post

    I have tied the items text to list box using server side programming. I want to bind the ImageURL for the list items in the Radlistbox also programmatic ally but I dont see the ImageURL property in the list of listbox properties or the properties of the item.

    I know there is a we have a HTML property something like this ImageUrl ="../App_Themes/Default/Images/

    I am not using the listboxitems tag here and so   can not use ImageUrl ="../App_Themes/Default/Images/. Is there any way i can use the server side programming to bing the image to the text items?


                <tlr:RadListBox RenderMode="Lightweight" runat="server" ID="RadListBoxSource" Height="165px" Width="100px"
                AllowTransfer="true" TransferToID="RadListBox1"
                ButtonSettings-AreaWidth="30px"  >
            <tlr:RadListBox RenderMode="Lightweight" runat="server" ID="RadListBox1" Height="165px" Width="100px"
                ButtonSettings-AreaWidth="35px" AllowReorder="true" >

  2. Ivan Danchev
    Ivan Danchev avatar
    1628 posts

    Posted 31 Aug 2016 Link to this post

    Hello Anirudh,

    There is no DataImageUrl property that would allow images to be bound to items. However, you can set the items' ImageUrl property in the code-behind, for example in the ListBox' ItemDataBound event. When the ListBox is loaded with items from the data source this event will fire for each item and you can get information about the item through the event's arguments (for instance e.Item.Text or e.Item.Value). Here's an example that sets the ImageUrl property of an item with text "Tokyo":
    protected void RadListBoxSource_ItemDataBound(object sender, RadListBoxItemEventArgs e)
        if (e.Item.Text == "Tokyo")
            e.Item.ImageUrl = "images/Tokyo.png";

    Ivan Danchev
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top