Master page:

The Master page is like that of the inherited form in Windows.NET. It is nothing but when you want to get the common look and feel of the particular part of your web we can go for master page.

For example: You may have a common header and footer or the user information in the entire page in the same format we can go for the master page concept.

It reduce much of your coding. We don't want to redo the same design in the entire page. And the highlight is when you change in the master page it will be automatically reflected in all the inherited forms. Now it becomes easy to maintain.

Now we will see how to work with master page. Here are the steps

Short Introduction about .NET 2005

Here the concept of IIS is partially eliminated instead we can create a web application in the ordinary directory as like that of windows application. The .net itself will take care of IIS i.e. internally it will create a database that will take care of IIS work.

Creating a Master Page

1. Open a new solution and include Masterpage2.master as in (Ref: Figure 1)

figure1.jpg

Figure 1

2. The master page will be included as follows in the solution (Ref: Figure 2)

figure2.JPG

Figure 2

3. Now make a design in the Masterpage2.master (Ref: Figure 3)

figure3.jpg

Figure 3

4. Now master page has been added and designed. Now try to add a new web page and inherit the masterpage2.master as shown in (Ref : Figure 4.1). While adding a new page make sure that the "Select Master Page" check box has been checked as shown in the figure 4.1

figure4.jpg

5. Now select the master page which you need to be inherited in the webpage (Ref: Figure 5)

figure5.JPG

Figure 5

6. Now the default 4.aspx the content of the masterpage2.master id inherited (Ref: Figure 6)

figure6.jpg

Figure 6

7. Set the startup page as default4.aspx and run your application now you can see the content of the masterpage2.master in default.aspx ( Ref : Figure 7)

figure7.jpg

Figure 7

Now when you open the default4.aspx code you can clearly see that the masterpage2.master class has been inherited. This is the way we achieve master paging in .net 2005 .