Share via


Create pages for SharePoint

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

You can create application pages, site pages, master pages and page layouts for a SharePoint site.

You can create application pages by using a template in Visual Studio. Create site pages, master pages, and page layouts, by using SharePoint Designer. Then, you can import these pages into Visual Studio to use them in a SharePoint project.

You can also modify the appearance and behavior of pages by using cascading style sheets, ECMAScript, and themes.

Types of SharePoint pages

The following table describes the four main types of pages that a SharePoint site contains.

Page Type Description
Application pages Create an application page if you want the page to contain custom code or you want the page to be shared across multiple sites. Otherwise, a site page might be the best choice.
Site pages Create a site page if you want to perform any of the following tasks:

- Add the page to a SharePoint library.
- Enable the page to host features such as dynamic Web Parts and Web Part Zones.
- Enable users to customize the page by using SharePoint Designer.

Do not create a site page if you want the page to contain custom code. Although you can add custom code to a site page, the code stops running when the user customizes the page by using SharePoint Designer.
Master pages Create a master page if you want to define a common structure for site pages and application pages.
Page layouts Page layouts are specific to Microsoft SharePoint Server and enable you to further define a common structure for site pages and application pages.

For an overview of each type of page, see Building Block: Pages and the User Interface, and Page Layouts and Master Pages.

Create application pages

You can create application pages in Visual Studio by adding an Application Page item to a SharePoint project. You can add controls to the page, and then handle control events by adding code.

You can set breakpoints in the code file of the page, start the debugger, and test the page on a local SharePoint site without performing any additional configuration steps. For more information, see Creating Application Pages for SharePoint.

Create site pages, master pages, and page layouts

You can create site pages, master pages, and page layouts by using SharePoint Designer. Then, you can import these pages into Visual Studio. Import your pages if you want to take advantage of the deployment or source control features that are available in Visual Studio. For more information, see Importing Items from an Existing SharePoint Site.

Because it is difficult to modify these pages after you import them, you should design these pages before you import them.

Create cascading style sheets, ECMAScript, and themes

Visual Studio does not provide templates for developing Cascading Style Sheets (CSS), ECMAScript (JavaScript, JScript), or theme files for SharePoint sites. You can create these files by using the guidance available in the SharePoint SDK or by using tools such as SharePoint Designer.

You can add these files to your solution directly or you can import them. In either case, you must create the appropriate mapped folders for each item that you add. For more information about how to create a mapped folder, see How to: add and remove mapped folders.

For more information about creating Cascading Style Sheets, see Cascading Style Sheets Class Usage in SharePoint Foundation. For more information about creating JavaScript and JScript files for a SharePoint solution, see Setting Up a Basic ASPX Page for ECMAScript. For more information about themes, see Building Block: Pages and the User Interface.

Title Description
Create application pages for SharePoint Describes how to add applications pages: .aspx content that is merged with a SharePoint master page.
How to: Create an application page Shows you how to create ASP.NET pages that run on a SharePoint site.
Walkthrough: Create a SharePoint application page Shows you how to design and debug an ASP.NET Web page for a SharePoint site.