views:

1170

answers:

2

I'm using the combobox control from the Ajax toolkit. Is there a way to set the image thats used for the button that shows up next to the dropdown box or am I stuck with the standard one?

A: 

If I recall correctly it's just a button, not an image. That said you could kill the borders and set the background to the image you want and you'd probably wind up with the results you're after.

Beware though, I abandoned the combobox control due to some really buggy behavior. It's not quite production ready IMHO.

zakster82
+1  A: 

I've never used this control, however I looked at the Ajax Control Toolkit demo site to take a look at it. It looks like the arrow button is simply a button (as zakster82 mentioned). On the ComboBox control itself, set the CssClass and then define the button descendant for that class with a different background image. Something like this:

.MyComboBoxStyle button {
  background-image:url(myNewArrowImage.gif);
}

Same padding / margins might be required to clean this up, obviously.

On a side note, I'd recommend not using the Ajax Control Toolkit as, like zakster82, I've found that a number of the controls on there are not quite production quality. Also many of them (the ComboBox included) are little more than fancy JavaScript that isn't even all that fancy and can muck up your markup. Obviously this is just my opinion. Your mileage may vary.

Phairoh
Thanks, that worked but I had to specify !important or the standard button would pop in front of the image and border-style: none to keep it looking like a regular image..MyComboBoxStyle button{ background-image: url(ig_cmboDownXP1.bmp) !important; border-style: none; }
Keith