Adding a new Content Page Part 1
How to add new contents
Once the master page of our site has been designed and saved, adding content pages are easy. We will now add a new content page to our project:
1. First, we need to open our project. Methods for opening a project are specified in chapter 2.
2. Move the mouse over the solution explorer tab to make the solution explorer window visible.
3. Right click on the project name in the solution explorer window. A menu will pop up
4. Select the `Add New Item...' option from the menu. A dialog box will be displayed
5. Since we want to add a content page, we will select the `Web Form' template from the `Templates' section. Web Forms are actually the web pages of our site. ASP.NET 2.0 web pages are known as web forms because they can contain control elements like text boxes, buttons, lists and check boxes which are processed by the web server.
6. The next thing to do is to provide a meaningful name to our page. In the `Name' text box (just below the Templates section), Default2.aspx is displayed as the name of this page. As we have seen earlier, when we start a new project, a page named Default.aspx is added automatically to our site. When we add more pages, they are named as Default2.aspx, Default3.aspx and so on. However, we can change the name here. We can also change the name of a page from the solution explorer by right clicking on the page and selecting the `Rename' option from the menu.
Let us change the name of the page from Deafault2.aspx to About.aspx.
7. To link this page to our master page, we need to check the `Select master page' check box. This step will tell the VWD IDE that we have a master page in our project and we want to link this new page to our master page.
8. Finally, click the `Add' Button.
9. Now we will open another dialog box with the option to select the master page. Since our project has only one master page (MasterPage.master), it is listed alone in the right hand side box. It is possible for a project to have more than one master page. In that case, select the master page to which you want to link the new content page.
10. That is it! A new content page - About.aspx - is added to our project. The page is opened in the source view.
11. Switch tabs to the design view. We can see that the elements from the master page are added to this page. The logo, banner, footer and the section for the site menu are all visible in our content page. However, we cannot modify them from here. There is a rectangular box with the label - `Content-Content1 (Custom)'. We will put the contents of the `About.aspx' page in this area.
12. We can now add some text by clicking inside the blank white area of this content box. Let us write something about our site, for example. We can format the text using the formatting toolbar. To keep things simple for now, we will add just a few lines of text and format them.
13. Now it is time to run our page. To do so press `Ctrl+F5' on the keyboard.
14. VWD will start the built-in web server. It can be viewed in the system tray of our desktop as a small yellow page icon with a gear:
Here is our page displayed in the browser!
The page looks good. We need to add some more content pages. For now, we are going to add a contact page, login page and a user registration page. We are not going to put any actual contents in these pages. After learning about controls and a bit of coding, we will complete these pages.
Here is the contact page for example:
As you can see, the page is just a placeholder and contains nothing useful right now. We will add similar placeholder pages to our project. The solution explorer displays all the pages added to our project:
We have added a few content pages to our project. However, we are missing one vital page. The very first page a visitor will see when she visits our site - the home page.
We can of course add a new content page for the home page using the process we have learned in this chapter. However, we are going to do something new. Remember that we have a page called Default.aspx in our project. This page was added automatically when we started the project. We are going to make this page our home page.
Click on the Default.aspx tab to make it visible. If the tab for this page is not there, we can double click the page name in the solution explorer or right click on the page name in the solution explorer and from the menu, select `Open'.
The page will open in the source view. Shift to design view. A blank page wil be displayed. The elements of the master page are not there. This is because the page Default.aspx was added to the project before we created the master page.







