Web Part Life Cycle
- OnInit: Controls Initialization (happens earlier in the lifecycle - view state changes have not been done yet and tracking of it has not been turned on.)
- OnLoad: Occurs when the controls are loaded by the page load event.
- CreateChildElement: Create any child controls that controls contain.
- EnsureChildElement : Ensure that CreateChildElement Event is complete. Use this to guarantee that control exist it before referencing it.
- OnPreRender : All controls are fully loaded on the page.
- RenderContents : Render Content Inside the Control
OnPreRender
- All controls are fully loaded on the page.
- VewState is Loaed
- All control values are current
- ViewState is not saved and can still be changed
- Last chance to change the property of the controls
OnPreRender Use
- Update any control property based on the other Professionalization properties.
- Get data from database
- Make web service calls
- Connect data binding
- Do any stuff that depends on the state and values of child controls
- Registor RegistorClientScript Block
Editor Parts
- Web control to customize the property
To read more about the Editor Parts please read this post.
Please also read SharePoint Web Part Best Practices
No comments:
Post a Comment