0
votes

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.

1

1 Answers

-1
votes

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