SharePoint Web 部件和 ASP.NET 用户控件
我正在 Visual Studio 2008 上为 MOSS 2007 开发 SharePoint Web 部件。到目前为止,我一直在手动将所有控件添加到后面的代码中...但之前的一篇文章建议我可以使用设计器来创建 ASP。 NET 用户控件,然后将其添加到 Web 部件,一切都很顺利... 请参见图 5 的示例。
但是,我似乎无法将新的 ASP.NET 用户控件添加到我的 MOSS WebPart 项目中,模板就是不出现。如果我创建一个 Web 应用程序并在其中创建用户控件,我将看不到任何要添加到项目中的 SharePoint 模板。最后,我尝试将一个简单的 aspx 文件及其后面的代码直接复制到我的 webpart,并将它们添加为“现有组件”......但现在设计器无法识别该 aspx 文件。接下来,我可能会尝试将两个项目添加到我的解决方案中,并仅引用 ASP.NET 应用程序中的任何 dll...
那么如何将 ASP 控件添加到我的 SharePoint WebPart 项目中,以便我可以使用 Visual Studio 设计器?
编辑:所以这里是需要修改 ProjectTypeGuids 的部分解决方案。当我尝试此操作时,它给我一个错误,提示“此安装不支持该项目类型”。我使用的是 Visual Studio 2008。
I am developing SharePoint Web Parts for MOSS 2007 on Visual Studio 2008. Up until now, I've been adding all my controls by hand to the code behind... but an earlier post suggested I could use the designer to create an ASP.NET User Control, then add it to the webpart, and everything is happy... See figure 5 for an example.
However, I can't seem to add a new ASP.NET User Control to my MOSS WebPart project, the template just doesn't appear. If I create a WebApplication and make my User Control in there, I can't see any SharePoint templates to add to the project. Finally, I tried copying a simple aspx file and its code behind to my webpart directly, and adding them as an "existing component"... but now the designer won't recognize the aspx file. Next, I'd probably try adding two projects to my solution, and just referencing any dll's from the ASP.NET application...
So how do I get an ASP control into my SharePoint WebPart project so that I can use the Visual Studio designer?
Edit: So here is a partial solution where the ProjectTypeGuids needs to be modified. When I try this, it gives me an error saying "The project type is not supported by this installation". I am using Visual Studio 2008.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试阅读以下一些教程:
http:// www.google.com/search?q=create+sharepoint+web+part+as+feature
您想要创建什么类型的功能和/或显示?您甚至可能不需要用户控件。例如,创建一个非常简单的“概念验证”HTML 表作为自定义 Web 控件(Web 部件)。将其创建为功能并使用解决方案框架进行部署:
使用 VSeWSS 1.3 创建 Web 部件 - 第 I 部分
使用 VSeWSS 1.3 创建 Web 部件 - 第二部分
Scott Guthrie 提供有关 Web 部件和用户控件的资源:
为 SharePoint 2007 编写自定义 Web 部件
Try reading some of the following tutorials:
http://www.google.com/search?q=create+sharepoint+web+part+as+feature
What type of functionality and/or display are you trying to create? You may not even need a user control. For example, create a very simple "proof of concept" HTML table as a custom Web control (Web Part). Create it as a Feature and use the Solution Framework to deploy it:
Create a Web Part with VSeWSS 1.3 - Part I
Create a Web Part with VSeWSS 1.3 - Part II
Scott Guthrie offers up resources here on Web Parts and User Controls:
Writing Custom Web Parts for SharePoint 2007