确定 XML 的 SharePoint Web 部件中的属性名称
我正在使用由独立第三方制作的自定义 Web 部件。我创建了一个功能,可以将此 Web 部件添加到页面中。它工作得很好,除了我无法弄清楚需要定义的特定属性的名称。我尝试了与工具窗格视图上的显示名称相匹配的明显名称,在所述显示名称前面添加公司名称,以及许多类似的排列。所有这一切都无济于事。我更愿意将该属性包含到该功能中,因为将来需要跨多个站点进行部署。每次手动配置都会让我的客户很痛苦。
简短而明显的答案是“询问第三方”。这可能会起作用,特别是对于这个特定的部分(它是一个 CodePlex Web 部件,作者最近在上周发布了一条评论)。但我对以前的第三方解决方案的体验并不理想,通常甚至没有得到任何回应,直到三周后他们问我是否仍然喜欢他们的产品。因此,由于这并不总是获取此信息的可靠方法,因此我认为最好的选择是找到一种方法来找出 Web 部件中的属性名称,我不仅可以将其用于此特定部件,还可以在所有未来的情况。
我确实查看了这个早期问题,它解决了类似的话题。但是,我无权访问 Web 部件的类,因此我无法在代码中找到方便的属性进行修改。或者,至少,如果我确实能够以某种方式接触到它,我当然不会意识到这一点。
先感谢您!
I'm employing a custom webpart that is made by an unaffiliated third party. I've created a feature which adds this webpart to a page. It's working mostly fine, except that I can't figure out the name of a specific property that needs to be defined. I tried obvious ones that match the display name on the tool pane view, adding the company's name in front of said display name, and many similar permutations. All of which to no avail. I would much prefer to include the property to the feature, as this will be necessary to deploy across multiple sites in the future. Manually configuring it every time will be a pain for my client.
The short, obvious answer is "Ask the third party". This can potentially work, particularly for this specific one (it is a CodePlex webpart and the author has posted a comment as recent as last week). But my experience with previous third party solutions has been less than optimal, usually even getting no response until they ask me three weeks later if I still like their product. So, since this is not always a reliable method to obtain this information, I was thinking the best option is to find out a way to figure out the name of properties in a webpart that I can use not just with this particular one, but in all future situations.
I did check out this earlier question which addresses a similar topic. However, I don't have access to the class for the webpart so I can't just find a convenient property in the code to modify. Or, at least, if I do have access to it in some fashion, I'm certainly unaware of it.
Thank you in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我了解,您正在尝试设置某个您不知道相应 XML 属性名称的 Web 部件属性。
您是否尝试导出 Web 部件?一种可能的检查可能是尝试导出 Web 部件以查看 Web 部件 XML 中出现的属性。如果它是公共属性,则 Web 部件 XML 很可能已定义该属性但没有任何值,例如
要导出 Web 部件,请转至“编辑页面”模式,单击 Web 部件上的向下箭头并选择“导出”。
另外,如果您的 dll 中有 Webpart 代码,您可以使用 Reflector 打开它并查看代码中设置了哪些属性吗?
希望这有帮助。
From what I understand, you are trying to set a certain webpart property for which you do not know the corresponding XML attribute name.
Did you try to export the web part? One possible check might be to try to export the webpart to see what properties come up in the webpart XML. If it is a common property, chances are the webpart XML will have that property already defined with no value e.g.
To export the webpart, go to Edit Page mode, click the down arrow on the webpart and choose Export.
Also, if you have the webpart code in a dll, can you use reflector to open it and see what properties are being set in code?
Hope this helps.