Page unload event in asp.net

前端 未结 3 1810
挽巷
挽巷 2020-12-08 20:02

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?

3条回答
  •  暖寄归人
    2020-12-08 20:44

    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.

提交回复
热议问题