Creating Master Page in ASP.NET4

Another good thing about the ASP.NET4 is Master Page. Master Page is a blue print that we are going to use on our web page. By creating the Master Page, we can use it on every single page that we create. For example, I was assigned to create a website which has three different pages. And every single pages has to have the same header and footer. So, in order to save time and effort, I just created one Master Page that contained header and footer, then I applied the Master Page to those three web pages. Therefore, I did not have to create the header and footer on every single page, I just created the header and footer in the Master Page.

master page

Figure 1: Overview of master page

Figure 1 shows us a web page that is created using a Master Page. Please see Figure 2 to compare the components on the Overview master page and the code.

code master page

Figure 2: Code behind the page

Figure 2 shows us the code behind the page in the Figure 1. We can see that there is no code for header and footer, so we just type and put the information we need as the content of the web page, and we do not have to worry about creating header and footer on every single pages that we create. Imagine if you have so many pages that contains similar header / footer or other features, and you have to create it again and again; it will not just waste your time and effort, but also make you difficult to fix any error or changes.

Categories: Portfolio | Tags: , , , | Leave a comment

Post navigation

Leave a comment

Blog at WordPress.com.