Hi i'm looking at the following entry on the code library.
http://www.telerik.com/community/code-library/aspnet-ajax/combobox/show-the-selected-item-image-in-input.aspx
I'm sure i'm very close to getting this to work. My combobox causes a postback.
When this function runs
function showImageOnSelectedItemChanging(sender, eventArgs) {
var input = sender.get_inputDomElement();
input.style.background = "url(" + eventArgs.get_item().get_imageUrl() + ") no-repeat";
}
it seems to set the image correctly. But after the postback is complete
function showFirstItemImage(sender) {
var input = sender.get_inputDomElement();
alert(input);
alert(sender.get_items().getItem(0).get_imageUrl());
input.style.background = "url(" + sender.get_items().getItem(0).get_imageUrl() + ") no-repeat";
}
that returns null. I've added in a couple of alerts to see whats going on, the alert(input) line is returning an element as expected, but the second alert is returning null.
Why is this ?
http://www.telerik.com/community/code-library/aspnet-ajax/combobox/show-the-selected-item-image-in-input.aspx
I'm sure i'm very close to getting this to work. My combobox causes a postback.
When this function runs
function showImageOnSelectedItemChanging(sender, eventArgs) {
var input = sender.get_inputDomElement();
input.style.background = "url(" + eventArgs.get_item().get_imageUrl() + ") no-repeat";
}
it seems to set the image correctly. But after the postback is complete
function showFirstItemImage(sender) {
var input = sender.get_inputDomElement();
alert(input);
alert(sender.get_items().getItem(0).get_imageUrl());
input.style.background = "url(" + sender.get_items().getItem(0).get_imageUrl() + ") no-repeat";
}
that returns null. I've added in a couple of alerts to see whats going on, the alert(input) line is returning an element as expected, but the second alert is returning null.
Why is this ?