its an asp.net bug
first the imagebutton does not use javascript. but asp.net does have a bug
in handling the postback of an image button when the enter key is pressed
instead of being clicked on.
the w3c spec says when an image button is clicked, in addtion to the value
being submitted, the x and y coordinates inside the image are passed (so the
button can be used as an imagemap).
take the following html
<input type=image src=myimg.gif value=1 name=mysubmit>
if you clicked on the upper right corner, then the browser sends:
mysubmit=1&mysubmit_x=1&mysubmit_y=1
now if you hit enter most browsers (but not IE) send
mysubmit=1
so if you are concerned where the user clicked, you know they didn't, but IE
sends
mysubmit=1&mysubmit_x=0&mysubmit_y=0
asp.net has a bug where it renders the image button as:
<input type=image src=myimg.gif name=mysubmit>
(no value attribute is rendered) so the click from above sends
mysubmit_x=1&mysubmit_y=1
and an enter press sends:
mysubmit_x=0&mysubmit_y=0 in IE
while in other browsers, no values for the image are posted at all.
asp.net is looking for the x or y value, doesn't see it and therefore can
not do the onclick dispatch. as an aside, the same behavior occurs if images
are not rendered (turned off by the user).
-- bruce (sqlwork.com)
| I tried to post this message before but didn't see it. In firefox, an
| OnClick event handler for the codebehind class is not being call on an
| asp:ImageButton. It works fine in i.e.? Any ideas?
|