How to create a Master Page in Visual Studio

Home > Search > How-to
  by

To create a master page in Visual Studio:

  1. In Visual Studio, on the right (solution explorer), hover over the name of our site, right-click and select Add > New Folder
  2. Name the new folder MasterPages
  3. With the MasterPages folder highlighted press Ctrl + Shift + A (or right-click and select Add > New Item)
  4. In the Add New Item pop-up box, select Web Forms Master Page and select Add. Name this main.master.
  5. Switch to design view and type Master Page

 

To create a page that uses the main.master page:

  1. In solution explorer, highlight the name of your site and press Ctrl + Shift + A (or right-click and select Add -> New Item)
  2. In the Add New Item pop-up box, select Web Forms with Master Page and select Add. Name this default.aspx.
  3. When prompted to select our a master page, select main.master
  4. Switch to design view and type Default Page

You can now publish your site, and your default.aspx page should display both Master Page and Default Page.

 

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter in the box below so that we can be sure you are a human.




Comments