为 sharepoint 创建 Web 部件
我看到了两种不同的方法来为共享点创建 Web 部件。哪一款最受大家青睐?
http://msdn.microsoft.com/en-us /library/aa973249%28office.12%29.aspx
I saw 2 different way to create web parts for sharepoint. Which one is preferred by most?
http://msdn.microsoft.com/en-us/library/aa973249%28office.12%29.aspx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
任何涉及 VSeWSS 的事情都会以痛苦告终,所以方法 1 肯定不适用。方法 2 也不理想,因为将 html 元素设置为控件变得难以管理,其程度超出了您在该演示中看到的程度。我使用一个相当简单的通用基类,它将用户控件作为类型参数,并让我将所有布局与共享点基础结构很好地分开。如果您以编程方式创建页面/Web 部件,则大多数 Web 部件 xml 也是可选的。
Anything involving VSeWSS is just going to end in pain, so method 1 is definitely out. Method 2 isn't ideal either, as setting up html elements as controls becomes unmanageable at a level just beyond what you see in that demo. I use a fairly simple generic base class that takes a user control as a type parameter and lets me keep all the layout nicely seperated from the sharepoint infrastructure. If you are creating pages/web parts programatically most of the web part xml turns out to be optional also.
对于我编写的几个 Web 部件,我想我更多地使用方法 #2,而不是方法 #1。看起来更简单,并且有可能在 SharePoint 环境之外重用(取决于业务逻辑的深度)。
For the few web parts I've written, I guess I've gone more with method #2 than method #1. Seems more straightforward and has the potential to be reused outside of the SharePoint environment (depending on the depth of your business logic).