Disable postback at click on a button
I could fix that using an UpdatePanel which includes the implicated controls/elements.
onClientClick="return false"
That should do it! Onclick
will refer to an ASP.net function, onClientClick
will render as OnClick
on the control in HTML.
onclick
is used to wire up your server side events. You need to use the OnClientClick
handler such as <asp:button OnClientClick="return false;" />
It worked for me like this:
In <body>
:
function myfunction() {
return false;
}
and in <head>
:
<asp:ImageButton ID="ImageButton1" runat="server" Height="52px" Width="58px" OnClientClick="myfunction(); return false;"/>