开发者

SharePoint Webpart and ASP.NET User Control

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 templ开发者_运维技巧ate 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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜