I'm not sure how Visual Web Part is different from the actual Web Part in SharePoint 2010.


2 Answers 2


Short explanation: As far as usage is concerned, in many common cases there are almost no actual differences - anything you can do with a webpart you could do with a visual web part. For many points of view the visual web part is only a tool that enables the developer to work with a user control instead of creating all controls in codebehind.

Visual web part are born (afaik) from the SmartPart webpart project first seen on SharePoint 2007. The idea behind that project was to create a web part that could display any user control, so that programmer could work on ascx file as for any other web project instead to have to resort to programmatically create the controls via the CreateChildControl method.
The visual web part template introduced in Visual Studio 2010 just does this: it creates a simplified smartpart that displays the attached user control by adding it to the control collection in the CreateChildControl event. No more no less.

That said, beware that the visual web part does use a control, so it may cause issues in specific situation. First thing that comes to mind is that a visual web part is not supported in a sandbox solution (but you can use a modified template - see here or search for sandboxed visual web part in the visual studio gallery).

Waldek does a great job in is blog listing all the main differences: here is the link. What follows is just an extract of his notices, reposted to avoid link rooting. Also notice that as posted by almostSharepointMaster in his answer, you should also have a look at this page from Microsoft which also provides some samples.

Web Part / Visual Web Part comparision

  • 1
    That is perfect explanation, everything is mentioned :)
    – Shkipper
    Commented Nov 21, 2012 at 10:49
  • Ps: to the downvoter, care to post a comment? You noticed anything wrong or that could be improved? I AM interessed in costructive criticism, thanks.
    – SPArcheon
    Commented Nov 21, 2012 at 11:16
  • there are no actual difference is a strong statment to make ;) if you look at msdn it begs to differ, upvoted to for everything else appart from that statment.... unless you mean how its displayed?
    – Ali Jafer
    Commented Nov 21, 2012 at 11:20
  • actually I was refering to the usage: I meant that what you can do with a visual web part you can do with a standard web part (worst case, you could manually rebuild the ascx control via codebehind). The opposite is not the case, since visual web part have some limits. But you are right, time to do some research and see if anything else comes out from it. Wait for an edit soon.
    – SPArcheon
    Commented Nov 21, 2012 at 11:28
  • ok, should be clearere I hope now. Will try to put that comparision in a table when I work out how to make the editor behave ^_^'
    – SPArcheon
    Commented Nov 21, 2012 at 11:57

visual webpart is a webpart that contains a reference to an ascx file that contains your controls.

a webpart is where you create your controls and everything else within it.

visual webpart is better for the designer to change the layout without going into c# code. So you would only need to change the ascx to change the look.

In Microsoft Office SharePoint Server 2007, developers create Web Parts by deriving from the WebPart class. One of the challenges that you face when designing a Web Part that has a complex user interface (UI) is the lack of drag-and-drop support. You must write the code from scratch, in the CreateChildControls method, to create the layout design of the Web Part, which can be time consuming.

An alternative approach can save development time:

  1. Create a web user control by using Microsoft Visual Studio 2010 and design the >control with the Visual Web Developer designer.

  2. Write the code-behind implementation of the user control.

  3. Create a Web Part to host the web user control.

Visual Web Developer provides drag-and-drop support without the need to write supporting code.

the main point to take note of is this:

Microsoft SharePoint 2010 introduced Visual Web Parts. Visual Web Parts are similar to user controls in that you can simply drag and drop items from the Toolbox onto your custom controls to create a Web Part UI. You also get the code-behind file where you implement the UI logic. Technically, the SharePoint 2010 Visual Web Part is an ASCX web user control that is hosted inside a standard Web Part.

A Visual Web Part is simply a classic Web Part that automatically loads the web user control with it. The advantage of this approach is that you can use Visual Web Developer to design the web user control. Traditional Web Parts differ from Visual Web Parts in several ways.

for more detailed info with advantages and disadvantages check:


btw im creating a visual webpart at this moment and its a bit of a pain but easier for the designer to ammend. Webparts for me is better to code by that i mean takes less time. Why? becuase i still have to make the ascx and the webpart to host the ascx :(

hope it helps :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.