Introduction to SharePoint Web Part

Creation

Refer the following link

http://www.c-sharpcorner.com/UploadFile/shivprasadk/12222301222009065151AM/122223.aspx

http://msdn.microsoft.com/en-us/library/ms452873.aspx

Life Cycle

The methods are called in the following order.

OnInit – Configuration values set using WebBrowsable properties and those in web part task pane are loaded into the web part. Initialize the values here.
LoadViewState – The view state of the web part is populated over here. (When its a post back)
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 been called and if not it would call 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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s