Sharepoint 2010:如何持久保存 SPList 对象?

发布于 2024-10-04 08:25:21 字数 474 浏览 6 评论 0原文

我正在编写具有附加功能的共享点资产选择器对话框的替代品。

需要浏览位于其他网站集中的媒体库。 因此,我添加了一个配置页面,您可以在其中将媒体库的 URL 添加到共享点属性包中。

在自定义 AssetPicker 对话框中,我将从配置的 URL 创建的 SPList 对象添加到名为 medialibs 的成员列表中。

我知道处理SPList对象所属的SPWeb和SPSite非常重要。我在页面的 OnUnload 事件中执行此操作,但发现每次回发时都会调用 OnUnload。 我无法每次在 OnLoad 中重建 medialibs 列表,因为页面上有一个树视图控件,它保存对 medialibs 中 SPList 对象的引用。如果我处理并重建它们,这些对象就会是新的且不同的。 树视图不能每次都重建,因为它会丢失打开哪些节点的信息。

如何通过回发保留媒体库的内容?如何确保当用户离开页面时正确处理 medialib 中的 SPList 对象?

谢谢!

I am writing a replacement for the sharepoint asset picker dialog with additional features.

There is a requirement to browse media libs which are located in other site collections.
So I added a configuration page where you can add the URLs to the media libs to the sharepoint property bag.

In the custom AssetPicker dialog I added the SPList objects created from the configured URLs to a member List called medialibs.

I know that it is very important to dspose the SPWeb and SPSite the SPList object belongs to. I do that in the OnUnload event of the page, but discovered that OnUnload is calld every time on postback.
I can't rebuild the medialibs list every time in OnLoad because there is a treeview control on the page which holds references to the SPList objects in medialibs. If I dispose and rebuild them, the objects are new and different.
The treeview cannot be rebuilt every time, because it would lose the information which nodes are opened.

How do I persist the contents of the medialibs over postback? How do I ensure the SPList objects in medialibs are properly disposed when the user leaves the page?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

何以畏孤独 2024-10-11 08:25:21

我不知道为什么你需要持久保存媒体库。在初始加载时,您将根据 SPList 对象填充 TreeView。然后 ViewState 处理跨请求的 TreeView 的持久性。 SPSite/SPWeb 对象将在填充阶段被处置(using 语句效果很好)。我错过了什么吗?

I'm not sure why you would require medialibs to be persisted. On the initial load, you would populate the TreeView based on your SPList objects. ViewState then handles persistence of the TreeView across requests. SPSite/SPWeb objects would be disposed of at the population stage (using statements work well). Did I miss something?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文