In ASP. NET, does the onbeforeunload event call _ dopostback function?

Source: Internet
Author: User
I want to call _ dopostback when the page leaves, but the server will not receive the PostBack notification.
Function Test ()

{

_ Dopostback ('button1 ','');

}

<Body ms_positioning = "gridlayout" onbeforeunload = "test ()">


However, if _ dopostback is called elsewhere, there is no problem.

I added a latency after _ dopostback.

<SCRIPT>

Function pause (numbermillis ){

VaR now = new date ();

VaR exittime = now. gettime () + numbermillis;

While (true ){

Now = new date ();

If (now. gettime ()> exittime)

Return;

}

}


Function Test ()

{

_ Dopostback ('button1 ','');

Pause (100 );

}

</SCRIPT>

However, I feel that the processing is not professional,

It feels like _ dopostback uses one thread and onbeforeunload uses another thread. If _ dopostback is completed first and the onbeforeunload is suspended for some time, OK...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.