Introducing the Visual Web Part in SharePoint 2010

Posted Tuesday, October 20, 2009 4:38 PM by CoreyRoth

You might have seen that there is a new designer for working with web parts in Visual Studio 2010.  This is actually, not quite the case, so I thought I would share with you how it actually works.  When you use the Visual Web Part SPI (SharePoint Project Item), it will create a number of files for you: a .cs file, a .webpart file, an elements.xml file, and a .ascx file.  That’s right, it creates an ASP.NET user control.  Now, the Visual Studio interface does a nice job of grouping all of the files together.  When you open the designer on the web part, you in fact just open the designer for the user control. 

So now you might be thinking, how does this work?  Well no SharePoint can’t host user controls directly still. In fact all it does is create a simple web part with a Page.LoadControl() method pointing at our user control.  This in fact is the same method we’ve been using for years to get user controls into SharePoint.  I don’t really see this as an issue though, since Visual Studio does a great job making it painless to deploy these now and use them inside SharePoint.

Comments

# Two Techniques for Deploying Sharepoint Content

Tuesday, March 23, 2010 12:12 PM by Two Techniques for Deploying Sharepoint Content

Pingback from  Two Techniques for Deploying Sharepoint Content

# Two Techniques for Deploying SharePoint Content

Tuesday, March 23, 2010 8:00 PM by Two Techniques for Deploying SharePoint Content

Pingback from  Two Techniques for Deploying SharePoint Content

# Two Techniques for Deploying Sharepoint Content

Tuesday, March 23, 2010 8:03 PM by Two Techniques for Deploying Sharepoint Content

Pingback from  Two Techniques for Deploying Sharepoint Content

# Two Techniques for Deploying SharePoint Content

Tuesday, March 23, 2010 8:16 PM by Two Techniques for Deploying SharePoint Content

Pingback from  Two Techniques for Deploying SharePoint Content

# Two Techniques for Deploying SharePoint Content

Tuesday, March 23, 2010 8:20 PM by Two Techniques for Deploying SharePoint Content

Pingback from  Two Techniques for Deploying SharePoint Content

Leave a Comment

(required)
(required)
(optional)
(required)