Add web part programmatically to a Sharepoint Page and save values into the web part personalization store

只愿长相守 提交于 2019-12-08 09:00:02

问题


In my project I programmatically create a web part page and add a web part to it using SPLimitedWebPartManager. I also want to set some properties for the web part and save it into the web part personalization scope. How can I access the personalization store for the web part.


回答1:


Use the method SaveChanges on SPLimitedWebPartManager after change your properties to set them.




回答2:


Please refer following post for adding web part programmatically:

http://www.etechplanet.com/post/2009/03/18/AddingRemoving-web-part-programmatically-in-SharePoint-website-using-C-Code.aspx




回答3:


To modify web part property values programmatically, refer following post:

http://www.etechplanet.com/post/2009/03/19/Modify-property-values-of-a-web-part-in-SharePoint-website-programmatically-using-C.aspx



来源:https://stackoverflow.com/questions/378430/add-web-part-programmatically-to-a-sharepoint-page-and-save-values-into-the-web

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!