Stop a postback in javascript

jmpena picture jmpena · May 14, 2009 · Viewed 31.6k times · Source

i have an ASP webform with a JQuery Thickbox, i have an image that opens the thickbox when user click.

once open the thickbox it shows me a grid with several rows and a button to select one and after the user select the record it returns to the main page the recordselected and cause a __doPostBack()

BUT! sometimes in IE6 it stay loading the postback and never ends i have to refresh the page and when it refresh it shows everything fine. but i dont want the postback stay loading AND it does not happend always.

i have to call a __doPostBack because i need to find info related to the selected record.

thanks.

Answer

rhett picture rhett · Mar 18, 2011

How I do it; How I've done it:

<asp:LinkButton ID="linkKB" OnClientClick="absolutizeWidth(); return false;"  runat="server">Columns too small?</asp:LinkButton>

The "return false" stops the postback of the server control after the javascript function executes. Very useful.