S
suzanne.boyle
Hi,
I'm adding an ImageButton as a child to a custom web control and
attaching an event handler to it. When the page posts back the event
is not being fired however. I initially assumed I had missed some
code or something however after playing about I've found that if I
change the control to a Button (or a LinkButton) the event fires.
Here is the code called in the overridden CreateChildControls method.
ImageButton btn = new ImageButton();
btn.ID = "test";
btn.AlternateText = "test";
btn.Command += new CommandEventHandler(btn_Command);
Like I say, if I change the ImageButton to a Button (and obviously
change AlternateText to Text) the event fires ok.
Can anyone shed some light on why Button works but ImageButton doesn't.
I'm adding an ImageButton as a child to a custom web control and
attaching an event handler to it. When the page posts back the event
is not being fired however. I initially assumed I had missed some
code or something however after playing about I've found that if I
change the control to a Button (or a LinkButton) the event fires.
Here is the code called in the overridden CreateChildControls method.
ImageButton btn = new ImageButton();
btn.ID = "test";
btn.AlternateText = "test";
btn.Command += new CommandEventHandler(btn_Command);
Like I say, if I change the ImageButton to a Button (and obviously
change AlternateText to Text) the event fires ok.
Can anyone shed some light on why Button works but ImageButton doesn't.