Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Page unload event in asp.net

Tags:

asp.net

Is it possible to call a write a Page_Unload event in code behind similar to Page_Load event? I wanted to call a method on Page Unload. How do I achieve that?

like image 932
tc. Avatar asked Sep 09 '25 16:09

tc.


1 Answers

With AutoEventWireup which is turned on by default on a page you can just add methods prepended with **Page_***event* and have ASP.NET connect to the events for you.

In the case of Unload the method signature is:

protected void Page_Unload(object sender, EventArgs e)

For details see the MSDN article.

like image 138
JProgrammer Avatar answered Sep 13 '25 18:09

JProgrammer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!