A Master Page in Visual Studio 2005 is just like a template. You can place banners, menus, images and etc on the master page. You can also include codes (functions) on the master page. You can include more than one master page in any asp.net 2005 web application.
Once you have the master page, you can generate the content page (aspx page) which is linked to the master page. This way, you can have several aspx pages (content pages) with a consistent look. In other words, all content pages generated using a master page, will have the same appearance as the master page. For example, if you have placed a banner at the top and navigation menu on the left side of the master page, all content pages will also have the banner at the top and menu on the left side.
How To Add Master Page To ASP.Net Project?
Adding a master page to an ASP.NET project is very easy. You just need to do the following steps:
- Right-click on the project name in the Solution Explorer window.
- Select Add New Item... from the pop up menu.
- Select Master Page from the Add New Item dialog box. If necessary, change the name and the language for the master page. Then click the Add button. You will see a master page is displayed either in the Source or Design view.
- Design you master page. For example, you can add an HTML table on the master page. After that, you can arrange the the ContentPlaceHolder control, images, buttons and other controls nicely within the HTML table. You may look at the image below for an example.
How To Add Content Page (aspx page) Using A Master Page?
To add a content page to your asp.net project using a particular master page is relatively easy. All you need to do are:
- Open the particular master page that you want to use to generate the master page.
- Right-click anywhere within the Design or Source view window and select Add Content Page from the pop up menu that appears.
- Notice the asp.net content control in the generated aspx page. This is where you place your content such as text, iframe, images and etc for your content page.
No comments:
Post a Comment