locked
why is page_load fired on partial postback? RRS feed

  • Question

  • User1024191908 posted

    I am using an updatepanel on my asp.net webform and when I push the button inside the update panel to cause a partial postback I see that the serverside page_load() which is for the whole page is still fired. why does it happen?

    Monday, March 12, 2018 6:23 PM

Answers

  • User475983607 posted

    I am using an updatepanel on my asp.net webform and when I push the button inside the update panel to cause a partial postback I see that the serverside page_load() which is for the whole page is still fired. why does it happen?

    This is by design and the main reason to use the UpdatePanel as it invokes the page life cycle and initializes all page members.

    This is opposed to invoking a static WebMethod via AJAX.  Since the WebMethod  is static, yo udo not have access to instance page members.

    See the openly published documentation.

    https://msdn.microsoft.com/en-us/library/bb386454.aspx

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 12, 2018 6:32 PM