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?
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?
5 Answers, 1 is accepted
0
Accepted
Princy
Top achievements
Rank 2
answered on 24 Sep 2010, 10:49 AM
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.
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.
0
Erik
Top achievements
Rank 2
answered on 05 Dec 2010, 06:58 PM
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.
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.
0
Hi Proovit,
Please modify your code like this:
Hope this helps.
Regards,
Yana
the Telerik team
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.
0
nickJr
Top achievements
Rank 1
answered on 13 Jan 2011, 10:59 PM
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
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
0
Hello,
Please try changing the background image also in OnClientKeyPressing event handler.
Hope this helps.
Kind regards,
Yana
the Telerik team
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.