Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I want to use the Visual Studio designer to make controls for my WebPart... I've been pointed to two approaches that seem ok. First, SmartParts... which I'll look into later. Second was to create an ASP.NET User Control, and add it explicitly when creating the webpart, similar to figure 5 in this article. This seems like an easy approach to me.

However, I've found I can't add ASP.NET User Controls to my WebPart Solution (the template doesn't appear to be an option). Alternatively, when I try to create a WebApplication, SharePoint templates are not available. So how do I add a User Control that I can modify with the Visual Designer to a SharePoint Web Part project?


Edit:

So here is a partial answer. However, when I add that GUID to the front or the back of the two pre-existing Project GUIDs already there, I get the error, "This project type is not supported by this installation." If I add it to the middle of the list, it will load... but the ASP.NET User Control template still doesn't appear as an option.

These are the GUIDs already in use by the webpart project...

{593B0543-81F6-4436-BA1E-4747859CAAE2};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}

share|improve this question
    
Could you please specify which Visual Studio version/edition you are using. –  Wictor Wilen MCA MCM MVP May 6 '10 at 7:38
    
The ProjectTypeGuids approach is correct for VS 2008. I would double check that you have the correct GUIDs. –  Charles Lee May 6 '10 at 8:22
    
I am using VS 2008 and SharePoint 2007... the two GUIDs listed were already in the webpart project. The new one from the article matches one created in a new web application project. –  Anonymous May 6 '10 at 16:12
add comment

3 Answers 3

I think you need to install this

http://cksdev.codeplex.com/

in the documentation they have mentioned about Sandboxed Visual Web Part - A visual Web Part that can be deployed as part of a sandboxed solution.

HTH

Thomson

share|improve this answer
    
It looks like this targets SharePoint 2010, correct? Our customer will be using only 2007 in the foreseeable future. –  Anonymous May 6 '10 at 21:03
add comment

These are the correct Project Type GUIDs to include the C# ASP.Net project items (such as web user controls).

If you use these then you should be able to add a user control to your project.

<ProjectTypeGuids>{349C5851-65DF-11DA-9384-00065B846F21};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

share|improve this answer
    
so those two GUIDs are for Web Applications and Windows, respectively. Mine has an additional GUID {593B0543-81F6-4436-BA1E-4747859CAAE2} for sharepoint apps... So I have all three. While it loads, I can't add items with from the web applications. Just to double check, people can do this with SharePoint 2007 and Visual Studio 2008? –  Anonymous May 6 '10 at 21:29
    
Yup. If this is VS 2010 then GUIDs may have changed for the project templates. –  Charles Lee May 8 '10 at 9:32
add comment

The article you are referring to is specific to SharePoint 2010. As your question has been tagged with SharePoint 2007 I assume SP2007 is your target environment.

Bad news, User Controls are not natively supported in SP2007, but as you mention you can take the Smart Part approach. There are some drawbacks to smart parts so you may want to have a good look at the Smart Part code and just take out the bits that deals with loading a user control into a regular SP2007 Web Part.

For more info see 'Dynamically Loading a User Control'.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.