Thursday, January 8, 2015

Difference between Web Part and Visual Web Part

Web Part
Visual Web Part
In Web part, everything has to done through code for UI as well as logic. It does not provide visual UI effect. Hence it affects the productivity.

Visual web part is a web part which contains the reference of user control in which we can place controls from designer and have separate code file to add business logic inside it. It improves the productivity to design the complex UI.
Web part can be deployed as a sandbox solution hence it will not impact the whole farm if any issue with simple web part code.

In SharePoint 2010,Visual web part cannot be deployed as a sandbox solution. It can be deployed as a farm solution.

You can use Visual studio 2010 SharePoint power tools extension to deploy visual web part as a sandbox solution. Power tool generate the complied code with user control as a part of assembly

Few SharePoint or Asp.Net web controls are not supported in sandbox solution due to that visual web part gives an error occasionally.
Web part can be extended by inheriting from the WebPart class. We cab reuse the web part functionality.
Visual web parts cannot be extended.
Web part does not affect the performance compare to visual web part.
It has user control and web part inside it, thus it takes long time to load the user control due to that it affects the performance.
Declaring web part properties and connection is easily doable in simple web part as code is written in web part itself.
It is awkward to manage the web part properties and connection declaration in visual web part as it has includes multiple files.

Note: In SharePoint 2013, there is only one template to create web part named SharePoint 2013 Visual Web Path which include the user control in solution as complied assembly that can be deployed as sandbox solution.

Enjoy SharePoint!!!

No comments:

Post a Comment