Subscribe:

Labels

Wednesday, June 8, 2011

SP and ASP.Net Page Life Cycle


ASP.Net Page life cycle.


S Start
I
Initialize
L
Load
V
Validate
E
Event Handling
R
Render

Sharepoint page life cycle:-

Everybody knows ASP.NET page life cycle and sharepoint also having virtual directry which has same HTTP Handler HTTP Modules so that one usually thinks that life cycle is same as ASP.NET Page Life Cycle but it's not. Here is SharePoint 2007 Page Life Cycle

    User request the SharePoint Page using http
    ASP.NET calls the WSS File provider
    WSS file provider returns the page from File or Database
    Page is parsed by SafeMode parsor if required
    Returned page is complied by ASP.NET Compiler
    WSS File provider collects the page layout class and complies it
    ASP.NET engine adds SharePoint Context Data to the site meta data and retreives the associated master page.
    Master page got compiled and responded back to the user.



Webpart page life cycle:-



OnInit – Configuration values set using WebBrowsable properties and those in web part task pane are loaded into the web part.

LoadViewState – The view state of the web part is populated over here.

CreateChildControls – All the controls specified are created and added to controls collection. When the page is being rendered for the first time the method generally occurs after the OnLoad() event. In case of postback, it is called before the OnLoad() event. We can make use of EnsureChildControls() - It checks to see if the CreateChildControls method has yet been called, and if it has not, calls it.

OnLoad

User Generated Event – for e.g. button click on the web part.

OnPreRender – Here we can change any of the web part properties before the control output is

drawn.

RenderContents – Html Output is generated.

SaveViewState - View state of the web part is serialized and saved.

Dispose

UnLoad.

2 comments:

  1. Hi,
    Nice article !
    Here is the another article which might be helpful to have clear understanding on the page request in sharepoint and its comparision with ASP.net page request.
    http://kalashnikovtechnoblogs.blogspot.in/2012/04/sharepoint-page-request-vs-aspnet-page.html
    Thanks,
    Dhaval Shah
    http://kalashnikovtechnoblogs.blogspot.in/

    ReplyDelete