SharePoint Webpart and ASP.NET User Control

Posted by tbischel on Stack Overflow See other posts from Stack Overflow or by tbischel
Published on 2010-05-06T00:17:04Z Indexed on 2010/05/06 0:28 UTC
Read the original article Hit count: 778

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?

© Stack Overflow or respective owner

Related posts about sharepoint2007

Related posts about ASP.NET