在知道页面所需的URL,语言和版本的情况下,如何获取窗口小部件属性。我正在尝试从同一解决方案中的完全不同的项目中获取小部件实例的属性。这可能吗?
答案 0 :(得分:0)
以防将来有人需要它。我想我已经知道了。记住在使用前先解析URL。
TreeProvider tree = new TreeProvider();
TreeNode staticNode = tree.SelectSingleNode(siteName, url, culture);
PageInfo pi = CMSWebPartPropertiesPage.GetPageInfo(staticNode.NodeAliasPath, staticNode.DocumentPageTemplateID, culture);
PageTemplateInstance templateInstance = pi.DocumentTemplateInstance;
WebPartInstance widgetInstance = templateInstance.GetWebPart(widgetName);