More in this section

Forums / Developing with Sitefinity / what is the page life cycle of events for Sitefinity?

what is the page life cycle of events for Sitefinity?

1 posts, 0 answered
  1. PVR
    PVR avatar
    1 posts
    Registered:
    19 Jul 2012
    07 Apr 2012
    Link to this post
    I am using Sitefinity v5.0.2523.0
    I have created a user control implementing Telerik.Sifefinity.Web.UI.SimpleView
    I also have a published page which has this UC on it.

    I have now attached a code-behind class to this published page, the published page has EnableViewState = true.
    I get a reference this UC from the code-behind via PageManager.LoadControl()
    I created a function uc_rebind() in the codebehind file so I can change the UC via public property and re-bind the UC.
    Ideally I want to apply changes after the UC has been initialized by the Sitefinty page cycle.

    When I call PageManager.LoadControl() it fires UC.InitializeControls() allowing may changes to be applied.
    But then it seems that UC.InitializeControls() is fired again by SimpleView.CreateChildControls() which may be part of the normal page lifecycle for loading the Sitefinity page. 

    I tried calling uc_rebind() from the code-behind Page_Load(), OnInit(), OnPreRender() so it fires last but cannot find the right location to guarantee this.

    Basically what is the page life cycle of events for Sitefinity?
    At what event on the code-behind class can I guarantee that when I access the UC my changes will not be lost?
    Should I not be using PageManager.LoadControl() to get a reference to the UC from the code-behind file because LoadControl() calls InitializeControls()?

    Thanks
1 posts, 0 answered