Persisting Programmatically Added WebParts

  • Thread starter Thread starter Imran
  • Start date Start date
I

Imran

Hi,

How can I persist a webpart that is added to a page using the webpart
managers addWebPart method in asp.net 2.0. My intention is to give the
user the ability to load a predetermined collection of web parts by
selecting a preset. Thanks in advance..
 
Imran,
Search for the following
enterSharedScope
PersonalizationScope.Shared
Personalization.ToggleScope

You need to make changes in shared scope then any changes or webparts you
add will be starting point for all other users. If you add webpart then all
other users will have that webpart as a starting point. As far as making a
selection for the users you could make a couple different pages.

My entire Dev Web Site is made of webparts. You are welcome to register and
check out how it works as a user, click the tree in the top left to enter
edit mode. click the folder icons to put webparts into your webpart folders.
http://www.DWS400.com

Good Luck
DWS
 
Hi,

Thanks for the reply DWS, but I think my problem is not with the scope.
What I want is to insert a webpart programmatically once when a user
clicks something and have it persist for that particular user without
needing to add it each time the user visits the page. Something akin to
what the catalog part does now. Thanks..
 
Hi,

It seems we have to extend the webpart manager and call the method
SetPersonalizationdirty() to persist dynamically added webparts.
 
Back
Top