Web Part page and Web Part Zone and Web Part life-cycle.

Web Part page and Web Part Zone and Web Part life-cycle.

Post by Gemma » Sat, 26 Nov 2005 00:43:39


Hi,

Does anyone know where this might be defined. The only thing I can find on
Microsoft sites is the Control Execution Lifecycle, which describes ASP.NET
stuff, but doesn't make reference to the differences introduced by
SharePoint and Web Parts.

For example, it is mentioned that when a Web Part is added to a page a
Post-back even occurs, regardless of whether it is appropriate. What other
things are there lurking about.

The reason I ask is that I have a button on a Web Part, which causes another
Web Part to be added to the current zone, but it doesn't display (it does
after a page refresh). I think this is caused by the post-back event of
adding the Web Part crashing into the button click event (or vice-versa).

So, if anyone knows of any good documentation concerning the life-cycle, and
possible a source of information about adding Web Parts
dynamically/programmatically (sources that don't lead to
http://www.yqcomputer.com/ , which is good as
far as it goes, but doesn't help me with my problems).

Many thanks
Gem
 
 
 

Web Part page and Web Part Zone and Web Part life-cycle.

Post by RGFuaWVsIE » Tue, 29 Nov 2005 11:16:02

Gemma,

It sounds like you're succesful in adding a WebPart to the WebPartZone-- but
you'll need to add it to the controls collection of the page (or of the
WebPartZone) on the page request that you want it to appear on as well. It
sounds like adding it to the WebPartZone only adds it for the next page
request cycle.

Daniel Larson
http://www.yqcomputer.com/

 
 
 

Web Part page and Web Part Zone and Web Part life-cycle.

Post by Gemma » Tue, 29 Nov 2005 21:26:48

Hi Daniel,

This sounds helpful. Now, the 64 thousand dollar question : Would you know
what method on which object I should call at what point within the
life-cycle to add the WebPart to the controls collection of the page (or of
the WebPartZone)?

Gem

"Daniel Larson (www.portalbuilder.org)"