How to prevent page reload on asp.net LinkButton OnClick function

I'm using the <asp:LinkButton />’s OnClick function on the server side to fetch data. I'm using OnClientClick to open a popup and populate data. But the page refreshes when I click the button. Please see the attached code and help me to fix the issue.

<asp:LinkButton ID="lnkEdit_Bill" runat="server" CssClass="lnkAddressButton" OnClientClick="javascript:ShowDialog_Both_New('Invoice','edit');" OnClick="lnkEdit_Bill_Click_new" >Edit</asp:LinkButton>

Google event.preventDefault(), I believe i've used that previously to prevent a postback. Also remove the OnClick, if that's not what you want, and just use OnClientClick.


Bro, if you don't want the postback, just fire the javascript. and you definitely don't need the server control. which you can present your code as below:

<a href="#" onclick="ShowDialog_Both_New('Invoice','edit'); return false;">Edit</a>

Let's says if you still insist want to user ASP.NET server control of LinkButton, then you can do something like this:

<asp:LinkButton ID="lnkEdit_Bill" runat="server" CssClass="lnkAddressButton"
OnClientClick="ShowDialog_Both_New('Invoice','edit'); return false;" >
Edit
</asp:LinkButton>