Prevent an asp.net button from doing a postback

Something that bugged me for ages in asp.net was how to prevent an asp.net button from automatically doing a postback.

To prevent a postback occuring simply make the OnClientClick event return false like this:

<asp:Button ID="button" runat="server" OnClientClick='return false' />


Subscribe via RSS

Back to all blog posts