Let us say you want to add a new page Page1.aspx to use Site.Master… Lets say that Site.Master already exists in your project…
If you were to add Page1.aspx as a simple .aspx page then you will have to make manual change to the <%@ Page directive of the page to make sure Inherits property is set correctly… But generally you will not need to do this if you add the file in the below fashion…
WEB SITE PROJECTS: If you are using a Web Site Project (i.e. below)
Then in that case you can Right click on your project –> Add New Item and “Select Master Page”
On the next page you will get an option to select the master page as shown below:
WEB APPLICATION PROJECTS (WAPs): If you are using a WAP (i.e. File –> New Project as shown below)
Then while adding a new page, right click on your project—> Add –> New Item and instead of selecting “Web Form” select “Web Content Form” as shown below:
When you now click the “Add” button you will get to select the Site.Master page that you had previously added to your project… Check the figure below…
Hope this helps…
- Vishal | Twitter: @VishalRJoshi |
No comments:
Post a Comment