0
votes

Can you have both onlcikc and onclientclick for image button controls? For the life of me I cannot get the onclientclick to fire. I think "onclientclick" gets rendered as "onclick" so how would two onclicks work?

<asp:ImageButton runat="server" ID="ibTest" onclick="server_event_handler" onclientclick="some_js_function" imageurl="..." />

I added "return", "return true/false" to both onclcienclick and to js function itself but to no avail. I added a "debugger" in js function to see if I hit it and I don't. If I create an html input control (of type "image") and set its onclick to the same javascript function, it hits it when clicked.

What I am trying to do is hide the that the button is in and replace it with a "Please Wait .." text to prevent users from clicking the button a hundred times when it is processing the event. I tried to do the hiding part in onclientclick.

1

1 Answers

0
votes

Try referencing the Javascript function as some_js_function();

So your code would read:

<asp:ImageButton runat="server" ID="ibTest" onclick="server_event_handler" onclientclick="some_js_function();" />