Stop a postback in javascript

后端 未结 4 1256
执念已碎
执念已碎 2021-01-06 10:51

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 an

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-06 11:14

    Are you trying to stop the post back after you refresh the page or after the Thickbox returns?

    If you do not want to execute the postback when the user fires off an event, you can just return false within that even handler.

    For example, the normal way to stop posting back during a page load is something like this:

    onClick="if(SOMECONDITION != true) { return false; }" 
    

    This will stop the postback being fired.

    If a postback is already in progress and you want to try and abort it (which I think is what you are asking), you will need to "stop" the page from loading (as that's what the javascript is doing). Maybe try this:

    IE: window.document.execCommand('Stop'); Other (Mozilla etc): window.stop();

    I haven't tried this in a while (and it's off the top of my head), so the code may need some massaging.

    If I've totally missed your question, I apologise, maybe you can clarify?

提交回复
热议问题