What does AutoEventWireUp page property mean?

前端 未结 3 1006
一整个雨季
一整个雨季 2020-11-29 01:57

I don\'t understand what the AutoEventWireUp page property is responsible for.

While surfing the net, I have found a lot of forums with discussions abou

3条回答
  •  执念已碎
    2020-11-29 02:31

    To add to previous answers; the automatic hooks are applied from TemplateControl.HookUpAutomaticHandlers. This method calls into TemplateControl.GetDelegateInformationWithNoAssert which contains which methods are considered as event handlers.

    These are, in System.Web, version 2.0:

    • On all classes deriving from Page: Page_PreInit, Page_PreLoad, Page_LoadComplete, Page_PreRenderComplete, Page_InitComplete, Page_SaveStateComplete.

    • On all classes deriving from TemplateControl: Page_Init, Page_Load, Page_DataBind, Page_PreRender, Page_UnLoad, Page_Error.`

    • Transaction support for all classes deriving from TemplateControl:

      • Page_AbortTransaction, or if it does not exist, OnTransactionAbort
      • Page_CommitTransaction, or if it does not exist, OnTransactionCommit

    System.Web, version 4.0, introduced a Page_PreRenderCompleteAsync for all classes derived from Page. That method, if present, will be registered using Page.RegisterAsyncTask and executed automatically "just before the PreRenderComplete event" (source: Page.ExecuteRegisteredAsyncTasks). This method seems very undocumented which suggest that it would be prefered to just call Page.RegisterAsyncTask with your own method instead.

提交回复
热议问题