WebPart Initialization

WebPart Initialization

Post by shane.nieb » Thu, 17 Jan 2008 07:36:17


I have several web parts on a page, some of which provide client-side
functionality (such as a google maps control). I've noticed that upon
first page load, everything works great. However, as soon as I invoke
a web part action such as minimizing or moving a part, those rich web
parts stop working. When I refresh the page, it works again.

It's as if something (OnInit, Render, etc) is called during page load,
but not during the web part post back. I should mention that my web
part zones are in an update panel (using .NET 3.5). Has anyone
experienced this before? Any suggestions?

Thanks!
Shane
 
 
 

WebPart Initialization

Post by shane.nieb » Wed, 23 Jan 2008 04:27:10


I saw the following recommendation: To inject JavaScript during a
partial postback, you need to use
ScriptManager.RegisterStartupScript().

This has gotten me further, but my solution seems to be messy. I just
don't understand why the javascript of a control doesn't get executed
automatically when it's added to the page dynamically...