Home > General > The Web Part Events

The Web Part Events


1. ONINIT EVENT:
Fires 1st: Startup of the Control and where in web parts, the storage system is loaded; also calls LoadViewState
(loads the view state for all controls); if you uncomment this event, you MUST include the base.OnInit(e) line.
This is the best place to define controls and its attributes that are added to the part. We can register
events of the controls here itself

2. ONLOAD EVENT:
Fires 2nd: OnLoad event – this is where startup functionality/processing happens, including trapping PostBack – AFTER THE
OnLoad events, any User Generated events (Click, and so on) are fired

3. CREATECHILDCONTROLS EVENT:
Fires 3rd (BEFORE any events and OnPreRender)- this creates any controls; you can use this event to do any
checking or resetting of controls. You can alternately define controls here (instead of OnInit) though
this can affect how well you can maintain view state.

4. Custom EVENT HANDLERS:
Fires 4th: Event Handlers – event handlers fire just AFTER CreateChildControls and before OnPreRender:

5. ONPRERENDER EVENT:
Fires 5th: OnPreRender event – called just before anything is drawn via the Render event
(here is where Properties can be changed before the controls are drawn); this event calls
SaveViewState to save the view state before rendering

6. RENDER EVENT:
Fires 6th (last): Render event – Render this control to the output (HTML Writer) parameter specified
The HTML writer to write out to

Advertisements
Categories: General Tags:
  1. No comments yet.
  1. No trackbacks yet.

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

%d bloggers like this: