I want to create a web part using VS, I found 3 types:

  1. webpart,
  2. visual web part,
  3. visual web part farm solution only

which one should I start?

  • 1
    You're going to have to provide more information on what you're trying to accomplish. Jul 7 '17 at 14:39
  • 1
    It depends on the need. And it depends on the options enabled on your server. Could you add more information? Jul 7 '17 at 14:50

The Visual Web Part can be used in sand box solutions and farm solutions but there are some restrictions to sand box solutions.

See https://msdn.microsoft.com/library/gg615454.aspx for which explains about the restrictions of sandbox solutions. Sometimes, this is the only option if your production environment has set these restrictions or if you need to deploy to SharePoint online.

The Visual Web Part (Farm Solution Only) can be used only in Farm solutions so it does not have these restrictions.

Please check this SharePoint stack exchange posts Visual Web Part vs Visual Web Part (Sandboxed)

  • thank you for your quick reply , What about webpart?
    – Habib
    Jul 7 '17 at 14:53

First, let's define the Web parts

Web parts are server-side controls that run inside a web part page: they're the building blocks of pages that appear on a SharePoint site. for more details check Using Visual Web Parts vs. Traditional Web Parts in SharePoint

In Visual Studio you can develop There types of Web Parts

  1. Code-Only Web Parts
  2. Visual Web Part.
  3. Visual web Part farm Solution only.

The Code only web part

  • It is the web part option in the visual studio, where The controls in Web Parts must be added by writing the code from scratch.(No (Drag and Drop))
  • Web Parts can be used in ASP.NET -based solutions only when the solution uses Web Parts pages.

Visual Web part

  • No need to add the control by writing the code from scratch.(Drag and Drop)
  • Can be used in the Farm and Sandbox solution but it can't access the full trust resource farm solutions.

Visual Web part (Farm solution only)

  • No need to add the control by writing the code from scratch.(Drag and Drop)
  • Can be used in the farm solution only, so it can access the full trust resource farm solutions.

Based on your requirement you can select which one you should you use.

Check also

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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