以编程方式将 Web 部件添加到 Sharepoint 页面并将值保存到 Web 部件个性化存储中
问题描述:
在我的项目中,我以编程方式创建了一个 Web 部件页面,并使用 SPLimitedWebPartManager 向其中添加了一个 Web 部件.我还想为 Web 部件设置一些属性并将其保存到 Web 部件个性化范围中.如何访问 Web 部件的个性化存储.
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.
答
在更改属性后使用 SPLimitedWebPartManager 上的 SaveChanges 方法来设置它们.
Use the method SaveChanges on SPLimitedWebPartManager after change your properties to set them.