Image items in the list

6 posts, 1 answers
  1. Achuthan
    Achuthan avatar
    31 posts
    Member since:
    May 2007

    Posted 24 Sep 2010 Link to this post

    Hello

    I want to show images in my combo box items and i've used ImageUrl property for RadComboBoxItem to show the images. But when i  select an item the image is not shown in the selected item.

    The items dont have any text and they are just images. So i'm not able to see the selected image and the selected item is shown as empty (since i dont have any text).

    Any ideas?

  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 24 Sep 2010 Link to this post

    Hello Achuthan,

    There is one Code Library to show the image of the selected Item in the RadComboBox's input.
    Show the selected Item image in input

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008

    Posted 05 Dec 2010 Link to this post

    Great. Works fine!

    I found one small problem, after postback the js function 'showFirstItemImage' is called and does therefore not show the correct image of the current selected item. 'showFirstItemImage' should thus display not the first item icon, but the selected item icon.

    how can i get the selected index of the item in js? then i post a new example for here with language flag selections.
  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 09 Dec 2010 Link to this post

    Hi Proovit,

    Please modify your code like this:

    <script language="javascript" type="text/javascript">
        function showImageOnSelectedItemChanging(sender, eventArgs) {
            var input = sender.get_inputDomElement();
     
            input.style.background = "url(" + eventArgs.get_item().get_imageUrl() + ") no-repeat";
        }
     
        function showFirstItemImage(sender) {
            var input = sender.get_inputDomElement();
     
            input.style.background = "url(" + sender.get_selectedItem().get_imageUrl() + ") no-repeat";
        }
    </script>

    Hope this helps.

    Regards,
    Yana
    the Telerik team
    Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  6. nickJr
    nickJr avatar
    18 posts
    Member since:
    Jul 2007

    Posted 13 Jan 2011 Link to this post

    Hi,

    your solution worked great.
    But following is the scenario i am having.

     I have a combobox with countries associated with flags.
    when the page loads, US is selected. And I see the us flag in front of the word.

    now when i click on the combo box and type the letter "C" it jumps to "canada". however the image still remains as the us, until i clickout.
    for example, if i keep pressing letter "C" the selected item keeps going down selecting the countries, however the image still remains as the us flag until i click outside or really selects the item.

    Is it possible to change the image while i navigate down the list?
    I have added a sample screen shot.

    In that you will see that I have selected Cayman Islands, however the image is still US, until i click out.
    (seems like i cannot attache the image for some reason)

    please advice.
    thanks
  7. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 17 Jan 2011 Link to this post

    Hello,

    Please try changing the background image also in OnClientKeyPressing event handler.

    Hope this helps.

    Kind regards,
    Yana
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017